Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: parser: imagetag: fix error codes in bcm963xx_parse_imagetag_partitions()

If the kstrtouint() calls fail, then this should return a negative
error code but it currently returns success.

Fixes: dd84cb022b31 ("mtd: bcm63xxpart: move imagetag parsing to its own parser")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/YBKFtNaFHGYBj+u4@mwanda

authored by

Dan Carpenter and committed by
Miquel Raynal
12ba8f8c dc2b3e5c

+4
+4
drivers/mtd/parsers/parser_imagetag.c
··· 83 83 pr_err("invalid rootfs address: %*ph\n", 84 84 (int)sizeof(buf->flash_image_start), 85 85 buf->flash_image_start); 86 + ret = -EINVAL; 86 87 goto out; 87 88 } 88 89 ··· 93 92 pr_err("invalid kernel address: %*ph\n", 94 93 (int)sizeof(buf->kernel_address), 95 94 buf->kernel_address); 95 + ret = -EINVAL; 96 96 goto out; 97 97 } 98 98 ··· 102 100 pr_err("invalid kernel length: %*ph\n", 103 101 (int)sizeof(buf->kernel_length), 104 102 buf->kernel_length); 103 + ret = -EINVAL; 105 104 goto out; 106 105 } 107 106 ··· 111 108 pr_err("invalid total length: %*ph\n", 112 109 (int)sizeof(buf->total_length), 113 110 buf->total_length); 111 + ret = -EINVAL; 114 112 goto out; 115 113 } 116 114