diff options
| author | Henry Martin <bsdhenrymartin@gmail.com> | 2025-04-04 14:14:38 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-04-20 10:15:06 +0200 |
| commit | ee2b0301d6bfe16b35d57947687c664ecb815775 (patch) | |
| tree | ce931690d927cc99a641994f281312d4c561bcf0 /drivers/ata | |
| parent | 9e0bdc15579e3ab619525583e1da699f50afb0d2 (diff) | |
| download | linux-ee2b0301d6bfe16b35d57947687c664ecb815775.tar.gz linux-ee2b0301d6bfe16b35d57947687c664ecb815775.tar.bz2 linux-ee2b0301d6bfe16b35d57947687c664ecb815775.zip | |
ata: pata_pxa: Fix potential NULL pointer dereference in pxa_ata_probe()
[ Upstream commit ad320e408a8c95a282ab9c05cdf0c9b95e317985 ]
devm_ioremap() returns NULL on error. Currently, pxa_ata_probe() does
not check for this case, which can result in a NULL pointer dereference.
Add NULL check after devm_ioremap() to prevent this issue.
Fixes: 2dc6c6f15da9 ("[ARM] pata_pxa: DMA-capable PATA driver")
Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/ata')
| -rw-r--r-- | drivers/ata/pata_pxa.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/ata/pata_pxa.c b/drivers/ata/pata_pxa.c index 538bd3423d85..1bdcd6ee741d 100644 --- a/drivers/ata/pata_pxa.c +++ b/drivers/ata/pata_pxa.c @@ -223,10 +223,16 @@ static int pxa_ata_probe(struct platform_device *pdev) ap->ioaddr.cmd_addr = devm_ioremap(&pdev->dev, cmd_res->start, resource_size(cmd_res)); + if (!ap->ioaddr.cmd_addr) + return -ENOMEM; ap->ioaddr.ctl_addr = devm_ioremap(&pdev->dev, ctl_res->start, resource_size(ctl_res)); + if (!ap->ioaddr.ctl_addr) + return -ENOMEM; ap->ioaddr.bmdma_addr = devm_ioremap(&pdev->dev, dma_res->start, resource_size(dma_res)); + if (!ap->ioaddr.bmdma_addr) + return -ENOMEM; /* * Adjust register offsets |
