projects
/
platform
/
kernel
/
linux-starfive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ddf66ae
)
mtd: rawnand: tmio: check return value after calling platform_get_resource()
author
Yang Yingliang
<yangyingliang@huawei.com>
Tue, 26 Apr 2022 08:49:13 +0000
(16:49 +0800)
committer
Miquel Raynal
<miquel.raynal@bootlin.com>
Wed, 27 Apr 2022 15:15:09 +0000
(17:15 +0200)
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
drivers/mtd/nand/raw/tmio_nand.c
patch
|
blob
|
history
diff --git
a/drivers/mtd/nand/raw/tmio_nand.c
b/drivers/mtd/nand/raw/tmio_nand.c
index de8e919d0ebe647ab39f474f01e445c303b0c051..8f1a42bf199c7ebc166e90b498d228cf14606e98 100644
(file)
--- a/
drivers/mtd/nand/raw/tmio_nand.c
+++ b/
drivers/mtd/nand/raw/tmio_nand.c
@@
-390,6
+390,9
@@
static int tmio_probe(struct platform_device *dev)
if (data == NULL)
dev_warn(&dev->dev, "NULL platform data!\n");
+ if (!ccr || !fcr)
+ return -EINVAL;
+
tmio = devm_kzalloc(&dev->dev, sizeof(*tmio), GFP_KERNEL);
if (!tmio)
return -ENOMEM;