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:
9b533a6
)
mtd: lpddr2_nvm: Fix possible null-ptr-deref
author
Hui Tang
<tanghui20@huawei.com>
Mon, 14 Nov 2022 09:02:40 +0000
(17:02 +0800)
committer
Miquel Raynal
<miquel.raynal@bootlin.com>
Thu, 17 Nov 2022 20:59:03 +0000
(21:59 +0100)
It will cause null-ptr-deref when resource_size(add_range) invoked,
if platform_get_resource() returns NULL.
Fixes:
96ba9dd65788
("mtd: lpddr: add driver for LPDDR2-NVM PCM memories")
Signed-off-by: Hui Tang <tanghui20@huawei.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link:
https://lore.kernel.org/linux-mtd/20221114090240.244172-1-tanghui20@huawei.com
drivers/mtd/lpddr/lpddr2_nvm.c
patch
|
blob
|
history
diff --git
a/drivers/mtd/lpddr/lpddr2_nvm.c
b/drivers/mtd/lpddr/lpddr2_nvm.c
index
367e2d9
..
e71af4c
100644
(file)
--- a/
drivers/mtd/lpddr/lpddr2_nvm.c
+++ b/
drivers/mtd/lpddr/lpddr2_nvm.c
@@
-433,6
+433,8
@@
static int lpddr2_nvm_probe(struct platform_device *pdev)
/* lpddr2_nvm address range */
add_range = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!add_range)
+ return -ENODEV;
/* Populate map_info data structure */
*map = (struct map_info) {