linux/drivers/mtd
Mirsad Todorovac 336c218dd7 mtd: slram: insert break after errors in parsing the map
GCC 12.3.0 compiler on linux-next next-20240709 tree found the execution
path in which, due to lazy evaluation, devlength isn't initialised with the
parsed string:

   289		while (map) {
   290			devname = devstart = devlength = NULL;
   291
   292			if (!(devname = strsep(&map, ","))) {
   293				E("slram: No devicename specified.\n");
   294				break;
   295			}
   296			T("slram: devname = %s\n", devname);
   297			if ((!map) || (!(devstart = strsep(&map, ",")))) {
   298				E("slram: No devicestart specified.\n");
   299			}
   300			T("slram: devstart = %s\n", devstart);
 → 301			if ((!map) || (!(devlength = strsep(&map, ",")))) {
   302				E("slram: No devicelength / -end specified.\n");
   303			}
 → 304			T("slram: devlength = %s\n", devlength);
   305			if (parse_cmdline(devname, devstart, devlength) != 0) {
   306				return(-EINVAL);
   307			}

Parsing should be finished after map == NULL, so a break is best inserted after
each E("slram: ... \n") error message.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Vignesh Raghavendra <vigneshr@ti.com>
Cc: linux-mtd@lists.infradead.org
Signed-off-by: Mirsad Todorovac <mtodorovac69@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20240711234319.637824-1-mtodorovac69@gmail.com
2024-08-23 19:25:46 +02:00
..
chips mtd: add missing MODULE_DESCRIPTION() macros 2024-07-01 11:56:28 +02:00
devices mtd: slram: insert break after errors in parsing the map 2024-08-23 19:25:46 +02:00
hyperbus mtd: hyperbus: rpc-if: Convert to platform remove callback returning void 2023-10-16 10:56:48 +02:00
lpddr mtd: lpddr2_nvm: Convert to platform remove callback returning void 2023-10-16 10:56:48 +02:00
maps mtd: add missing MODULE_DESCRIPTION() macros 2024-07-01 11:56:28 +02:00
nand MTD changes: 2024-07-20 11:52:17 -07:00
parsers mtd: cmdlinepart: Replace dbg() macro with pr_debug() 2024-07-01 11:56:30 +02:00
spi-nor mtd: spi-nor: winbond: fix w25q128 regression 2024-06-21 17:49:36 +02:00
tests mtd: make mtd_test.c a separate module 2024-07-01 11:56:25 +02:00
ubi ubi: Fix ubi_init() ubiblock_exit() section mismatch 2024-07-28 20:08:25 +02:00
ftl.c mtd: ftl: use container_of() rather than cast 2022-09-19 18:14:53 +02:00
inftlcore.c mtd: inftlcore: fix repeated words in comments 2022-11-07 17:14:21 +01:00
inftlmount.c
Kconfig mtdblock: Add comment about UBI block devices 2021-08-06 22:05:13 +02:00
Makefile
mtd_blkdevs.c block: move the add_random flag to queue_limits 2024-06-19 07:58:28 -06:00
mtdblock_ro.c mtdblock: make warning messages ratelimited 2023-07-27 17:16:14 +02:00
mtdblock.c mtdblock: make warning messages ratelimited 2023-07-27 17:16:14 +02:00
mtdchar.c mtdchar: mark bits of ioctl handler noinline 2023-06-01 18:12:31 +02:00
mtdconcat.c mtd: fix repeated word in comment 2022-09-20 10:40:30 +02:00
mtdcore.c * MTD 2024-05-16 09:04:52 -07:00
mtdcore.h mtd: use refcount to prevent corruption 2023-07-12 13:30:08 +02:00
mtdoops.c mtd: mtdoops: panic caused mtdoops to call mtdoops_erase function immediately 2022-11-07 17:08:00 +01:00
mtdpart.c mtd: mtdpart: check for subpartitions parsing result 2023-10-16 10:50:32 +02:00
mtdpstore.c mtd: Fix a typo in a comment 2022-09-19 18:14:53 +02:00
mtdsuper.c mtd: key superblock by device number 2023-08-31 12:47:15 +02:00
mtdswap.c mtd: always initialize 'stats' in struct mtd_oob_ops 2022-09-21 10:38:07 +02:00
nftlcore.c mtd: always initialize 'stats' in struct mtd_oob_ops 2022-09-21 10:38:07 +02:00
nftlmount.c
rfd_ftl.c mtd/rfd_ftl: don't cast away the type when calling add_mtd_blktrans_dev 2021-08-23 10:01:06 +02:00
sm_ftl.c mtd: sm_ftl: Fix typos in comments 2023-06-22 23:00:43 +02:00
sm_ftl.h
ssfdc.c mtd: ssfdc: Improve a size determination in ssfdcr_add_mtd() 2024-02-05 14:22:39 +01:00