[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230209092814.10847-1-jiasheng@iscas.ac.cn>
Date: Thu, 9 Feb 2023 17:28:14 +0800
From: Jiasheng Jiang <jiasheng@...as.ac.cn>
To: s.shtylyov@....ru, damien.lemoal@...nsource.wdc.com
Cc: linux-ide@...r.kernel.org, linux-kernel@...r.kernel.org,
Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] ata: pata_pxa: Add missing check for devm_ioremap
Add the check for the return value of the devm_ioremap in order to avoid
NULL pointer dereference.
Fixes: 2dc6c6f15da9 ("[ARM] pata_pxa: DMA-capable PATA driver")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
drivers/ata/pata_pxa.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/ata/pata_pxa.c b/drivers/ata/pata_pxa.c
index 985f42c4fd70..a20bb0824573 100644
--- a/drivers/ata/pata_pxa.c
+++ b/drivers/ata/pata_pxa.c
@@ -227,6 +227,8 @@ static int pxa_ata_probe(struct platform_device *pdev)
resource_size(ctl_res));
ap->ioaddr.bmdma_addr = devm_ioremap(&pdev->dev, dma_res->start,
resource_size(dma_res));
+ if (!ap->ioaddr.cmd_addr || !ap->ioaddr.ctl_addr || !ap->ioaddr.bmdma_addr)
+ return -ENOMEM;
/*
* Adjust register offsets
--
2.25.1
Powered by blists - more mailing lists