Skip to content

Commit 9b2152f

Browse files
Yang Yingliangmiquelraynal
authored andcommitted
mtd: rawnand: tmio: check return value after calling platform_get_resource()
It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value. 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-3-yangyingliang@huawei.com
1 parent ddf66ae commit 9b2152f

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/mtd/nand/raw/tmio_nand.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,9 @@ static int tmio_probe(struct platform_device *dev)
390390
if (data == NULL)
391391
dev_warn(&dev->dev, "NULL platform data!\n");
392392

393+
if (!ccr || !fcr)
394+
return -EINVAL;
395+
393396
tmio = devm_kzalloc(&dev->dev, sizeof(*tmio), GFP_KERNEL);
394397
if (!tmio)
395398
return -ENOMEM;

0 commit comments

Comments
 (0)