Commit 1162bc2f authored by Denis Arefev's avatar Denis Arefev Committed by Miquel Raynal
Browse files

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: default avatarDenis Arefev <arefev@swemel.ru>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20240315093758.20790-1-arefev@swemel.ru
parent 26729dbb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ static int parse_redboot_partitions(struct mtd_info *master,
			offset -= master->erasesize;
		}
	} else {
		offset = directory * master->erasesize;
		offset = (unsigned long) directory * master->erasesize;
		while (mtd_block_isbad(master, offset)) {
			offset += master->erasesize;
			if (offset == master->size)