]> git.baikalelectronics.ru Git - kernel.git/commit
mtd: rawnand: cadence: fix possible null-ptr-deref in cadence_nand_dt_probe()
authorYang Yingliang <yangyingliang@huawei.com>
Tue, 26 Apr 2022 08:49:11 +0000 (16:49 +0800)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 27 Apr 2022 15:15:05 +0000 (17:15 +0200)
commitab4948dfb7259f461e8c7ee7caa650371b912117
treef782e485dd90e00be1b0e854776761092bc11542
parent847f4b90fa39fb8b0ada839238777fa7f2f67e87
mtd: rawnand: cadence: fix possible null-ptr-deref in cadence_nand_dt_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.
And use devm_platform_get_and_ioremap_resource() to simplify code.

Fixes: 989ffb7e6560 ("mtd: rawnand: Add new Cadence NAND driver to MTD subsystem")
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-1-yangyingliang@huawei.com
drivers/mtd/nand/raw/cadence-nand-controller.c