Skip to content

Commit ddf66ae

Browse files
Yang Yingliangmiquelraynal
authored andcommitted
mtd: rawnand: intel: fix possible null-ptr-deref in ebu_nand_probe()
It will cause null-ptr-deref when using 'res', if platform_get_resource() returns NULL, so move using 'res' after devm_ioremap_resource() that will check it to avoid null-ptr-deref. Fixes: 0b1039f ("mtd: rawnand: Add NAND controller support on Intel LGM SoC") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20220426084913.4021868-2-yangyingliang@huawei.com
1 parent a28ed09 commit ddf66ae

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/mtd/nand/raw/intel-nand-controller.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,9 +619,9 @@ static int ebu_nand_probe(struct platform_device *pdev)
619619
resname = devm_kasprintf(dev, GFP_KERNEL, "nand_cs%d", cs);
620620
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, resname);
621621
ebu_host->cs[cs].chipaddr = devm_ioremap_resource(dev, res);
622-
ebu_host->cs[cs].nand_pa = res->start;
623622
if (IS_ERR(ebu_host->cs[cs].chipaddr))
624623
return PTR_ERR(ebu_host->cs[cs].chipaddr);
624+
ebu_host->cs[cs].nand_pa = res->start;
625625

626626
ebu_host->clk = devm_clk_get(dev, NULL);
627627
if (IS_ERR(ebu_host->clk))

0 commit comments

Comments
 (0)