[PATCH -next] ide: add the return pointer check for plat_ide_probe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Zhang Qilong <zhangqilong3@xxxxxxxxxx>

If io map failed in devm_ioremap/devm_ioport_map, base
or alt_base will be null, it will cause setup port error
later but it won't be found out in plat_ide_setup_ports.

Signed-off-by: Zhang Qilong <zhangqilong3@xxxxxxxxxx>
---
 drivers/ide/ide_platform.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/ide/ide_platform.c b/drivers/ide/ide_platform.c
index 91639fd6c276..fdbc565ef142 100644
--- a/drivers/ide/ide_platform.c
+++ b/drivers/ide/ide_platform.c
@@ -86,6 +86,11 @@ static int plat_ide_probe(struct platform_device *pdev)
 			res_alt->start, resource_size(res_alt));
 	}
 
+	if (!base || !alt_base) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
 	memset(&hw, 0, sizeof(hw));
 	plat_ide_setup_ports(&hw, base, alt_base, pdata, res_irq->start);
 	hw.dev = &pdev->dev;
-- 
2.17.1




[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux