* [PATCH v3] mtd: powernv_flash: check return value of devm_kasprintf()
@ 2023-10-19 6:56 ` Yi Yang
0 siblings, 0 replies; 3+ messages in thread
From: Yi Yang @ 2023-10-19 6:56 UTC (permalink / raw)
To: miquel.raynal, richard, vigneshr, mpe, npiggin, christophe.leroy,
u.kleine-koenig, tudor.ambarus, robh
Cc: linux-mtd, linuxppc-dev
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: acfe63ec1c59 ("mtd: Convert to using %pOFn instead of device_node.name")
Signed-off-by: Yi Yang <yiyang13@huawei.com>
---
v2:Change commit log, and fix error check code.
v3:No need for error messages upon memory allocation failures.
---
drivers/mtd/devices/powernv_flash.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/mtd/devices/powernv_flash.c b/drivers/mtd/devices/powernv_flash.c
index 66044f4f5bad..d3fc1b9c2bd5 100644
--- a/drivers/mtd/devices/powernv_flash.c
+++ b/drivers/mtd/devices/powernv_flash.c
@@ -207,6 +207,9 @@ static int powernv_flash_set_driver_info(struct device *dev,
* get them
*/
mtd->name = devm_kasprintf(dev, GFP_KERNEL, "%pOFP", dev->of_node);
+ if (!mtd->name)
+ return -ENOMEM;
+
mtd->type = MTD_NORFLASH;
mtd->flags = MTD_WRITEABLE;
mtd->size = size;
--
2.25.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v3] mtd: powernv_flash: check return value of devm_kasprintf()
@ 2023-10-19 6:56 ` Yi Yang
0 siblings, 0 replies; 3+ messages in thread
From: Yi Yang @ 2023-10-19 6:56 UTC (permalink / raw)
To: miquel.raynal, richard, vigneshr, mpe, npiggin, christophe.leroy,
u.kleine-koenig, tudor.ambarus, robh
Cc: linuxppc-dev, linux-mtd
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: acfe63ec1c59 ("mtd: Convert to using %pOFn instead of device_node.name")
Signed-off-by: Yi Yang <yiyang13@huawei.com>
---
v2:Change commit log, and fix error check code.
v3:No need for error messages upon memory allocation failures.
---
drivers/mtd/devices/powernv_flash.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/mtd/devices/powernv_flash.c b/drivers/mtd/devices/powernv_flash.c
index 66044f4f5bad..d3fc1b9c2bd5 100644
--- a/drivers/mtd/devices/powernv_flash.c
+++ b/drivers/mtd/devices/powernv_flash.c
@@ -207,6 +207,9 @@ static int powernv_flash_set_driver_info(struct device *dev,
* get them
*/
mtd->name = devm_kasprintf(dev, GFP_KERNEL, "%pOFP", dev->of_node);
+ if (!mtd->name)
+ return -ENOMEM;
+
mtd->type = MTD_NORFLASH;
mtd->flags = MTD_WRITEABLE;
mtd->size = size;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3] mtd: powernv_flash: check return value of devm_kasprintf()
2023-10-19 6:56 ` Yi Yang
(?)
@ 2023-10-19 9:00 ` kernel test robot
-1 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2023-10-19 9:00 UTC (permalink / raw)
To: Yi Yang, miquel.raynal, richard, vigneshr, mpe, npiggin,
christophe.leroy, u.kleine-koenig, tudor.ambarus, robh
Cc: oe-kbuild-all
Hi Yi,
kernel test robot noticed the following build warnings:
[auto build test WARNING on mtd/mtd/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Yi-Yang/mtd-powernv_flash-check-return-value-of-devm_kasprintf/20231019-145927
base: https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next
patch link: https://lore.kernel.org/r/20231019065618.318495-1-yiyang13%40huawei.com
patch subject: [PATCH v3] mtd: powernv_flash: check return value of devm_kasprintf()
reproduce: (https://download.01.org/0day-ci/archive/20231019/202310191650.ib8cKENG-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310191650.ib8cKENG-lkp@intel.com/
# many are suggestions rather than must-fix
ERROR:TRAILING_WHITESPACE: trailing whitespace
#26: FILE: drivers/mtd/devices/powernv_flash.c:212:
+^I$
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-19 9:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-19 6:56 [PATCH v3] mtd: powernv_flash: check return value of devm_kasprintf() Yi Yang
2023-10-19 6:56 ` Yi Yang
2023-10-19 9:00 ` kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.