Skip to content

Commit da7a5e7

Browse files
Dan Carpentergregkh
authored andcommitted
mtd: parser: imagetag: fix error codes in bcm963xx_parse_imagetag_partitions()
[ Upstream commit 12ba8f8 ] If the kstrtouint() calls fail, then this should return a negative error code but it currently returns success. Fixes: dd84cb0 ("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 Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 86399c1 commit da7a5e7

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

drivers/mtd/parsers/parser_imagetag.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ static int bcm963xx_parse_imagetag_partitions(struct mtd_info *master,
8383
pr_err("invalid rootfs address: %*ph\n",
8484
(int)sizeof(buf->flash_image_start),
8585
buf->flash_image_start);
86+
ret = -EINVAL;
8687
goto out;
8788
}
8889

@@ -92,6 +93,7 @@ static int bcm963xx_parse_imagetag_partitions(struct mtd_info *master,
9293
pr_err("invalid kernel address: %*ph\n",
9394
(int)sizeof(buf->kernel_address),
9495
buf->kernel_address);
96+
ret = -EINVAL;
9597
goto out;
9698
}
9799

@@ -100,6 +102,7 @@ static int bcm963xx_parse_imagetag_partitions(struct mtd_info *master,
100102
pr_err("invalid kernel length: %*ph\n",
101103
(int)sizeof(buf->kernel_length),
102104
buf->kernel_length);
105+
ret = -EINVAL;
103106
goto out;
104107
}
105108

@@ -108,6 +111,7 @@ static int bcm963xx_parse_imagetag_partitions(struct mtd_info *master,
108111
pr_err("invalid total length: %*ph\n",
109112
(int)sizeof(buf->total_length),
110113
buf->total_length);
114+
ret = -EINVAL;
111115
goto out;
112116
}
113117

0 commit comments

Comments
 (0)