mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-12 20:35:23 +02:00
mtd: partitions: redboot: Added conversion of operands to a larger type
[ Upstream commit 1162bc2f8f
]
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 <arefev@swemel.ru>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20240315093758.20790-1-arefev@swemel.ru
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
94111446fa
commit
5266cbcf3a
|
@ -102,7 +102,7 @@ nogood:
|
||||||
offset -= master->erasesize;
|
offset -= master->erasesize;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
offset = directory * master->erasesize;
|
offset = (unsigned long) directory * master->erasesize;
|
||||||
while (mtd_block_isbad(master, offset)) {
|
while (mtd_block_isbad(master, offset)) {
|
||||||
offset += master->erasesize;
|
offset += master->erasesize;
|
||||||
if (offset == master->size)
|
if (offset == master->size)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user