projects
/
linux-2.6-microblaze.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
60ec53a
)
mtd: rawnand: intel: check return value of devm_kasprintf()
author
Yi Yang
<yiyang13@huawei.com>
Thu, 19 Oct 2023 06:55:37 +0000
(06:55 +0000)
committer
Miquel Raynal
<miquel.raynal@bootlin.com>
Fri, 27 Oct 2023 17:43:18 +0000
(19:43 +0200)
devm_kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure. Ensure the allocation was successful by
checking the pointer validity.
Fixes:
0b1039f016e8
("mtd: rawnand: Add NAND controller support on Intel LGM SoC")
Signed-off-by: Yi Yang <yiyang13@huawei.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link:
https://lore.kernel.org/linux-mtd/20231019065537.318391-1-yiyang13@huawei.com
drivers/mtd/nand/raw/intel-nand-controller.c
patch
|
blob
|
history
diff --git
a/drivers/mtd/nand/raw/intel-nand-controller.c
b/drivers/mtd/nand/raw/intel-nand-controller.c
index
cb5d88f
..
f0ad230
100644
(file)
--- a/
drivers/mtd/nand/raw/intel-nand-controller.c
+++ b/
drivers/mtd/nand/raw/intel-nand-controller.c
@@
-619,6
+619,11
@@
static int ebu_nand_probe(struct platform_device *pdev)
ebu_host->cs_num = cs;
resname = devm_kasprintf(dev, GFP_KERNEL, "nand_cs%d", cs);
+ if (!resname) {
+ ret = -ENOMEM;
+ goto err_of_node_put;
+ }
+
ebu_host->cs[cs].chipaddr = devm_platform_ioremap_resource_byname(pdev,
resname);
if (IS_ERR(ebu_host->cs[cs].chipaddr)) {
@@
-649,6
+654,11
@@
static int ebu_nand_probe(struct platform_device *pdev)
}
resname = devm_kasprintf(dev, GFP_KERNEL, "addr_sel%d", cs);
+ if (!resname) {
+ ret = -ENOMEM;
+ goto err_cleanup_dma;
+ }
+
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, resname);
if (!res) {
ret = -EINVAL;