Skip to content

Commit 1162bc2

Browse files
Denis Arefevmiquelraynal
authored andcommitted
mtd: partitions: redboot: Added conversion of operands to a larger type
The value of an arithmetic expression directory * master->erasesize is subject to overflow due to a failure to cast operands to a larger data type before perfroming arithmetic Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Denis Arefev <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent 26729db commit 1162bc2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/mtd/parsers/redboot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ static int parse_redboot_partitions(struct mtd_info *master,
102102
offset -= master->erasesize;
103103
}
104104
} else {
105-
offset = directory * master->erasesize;
105+
offset = (unsigned long) directory * master->erasesize;
106106
while (mtd_block_isbad(master, offset)) {
107107
offset += master->erasesize;
108108
if (offset == master->size)

0 commit comments

Comments
 (0)