mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-27 22:53:55 +08:00
tty: serial: 8250_mtk: Fix potential NULL pointer dereference
There is a potential NULL pointer dereference in case devm_kzalloc()
fails and returns NULL.
Fix this by adding a NULL check on data->dma
This bug was detected with the help of Coccinelle.
Fixes: 85b5c1dd04
("serial: 8250-mtk: add uart DMA support")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
f17b5f06cb
commit
1575c083a7
@ -357,6 +357,9 @@ static int mtk8250_probe_of(struct platform_device *pdev, struct uart_port *p,
|
||||
if (dmacnt == 2) {
|
||||
data->dma = devm_kzalloc(&pdev->dev, sizeof(*data->dma),
|
||||
GFP_KERNEL);
|
||||
if (!data->dma)
|
||||
return -ENOMEM;
|
||||
|
||||
data->dma->fn = mtk8250_dma_filter;
|
||||
data->dma->rx_size = MTK_UART_RX_SIZE;
|
||||
data->dma->rxconf.src_maxburst = MTK_UART_RX_TRIGGER;
|
||||
|
Loading…
Reference in New Issue
Block a user