Skip to content

Commit 9b458e8

Browse files
Gax-cmiquelraynal
authored andcommitted
mtd: diskonchip: Cast an operand to prevent potential overflow
There may be a potential integer overflow issue in inftl_partscan(). parts[0].size is defined as "uint64_t" while mtd->erasesize and ip->firstUnit are defined as 32-bit unsigned integer. The result of the calculation will be limited to 32 bits without correct casting. Fixes: 1da177e ("Linux-2.6.12-rc2") Signed-off-by: Zichen Xie <[email protected]> Cc: [email protected] Signed-off-by: Miquel Raynal <[email protected]>
1 parent d8e4771 commit 9b458e8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/mtd/nand/raw/diskonchip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,7 @@ static inline int __init inftl_partscan(struct mtd_info *mtd, struct mtd_partiti
10981098
(i == 0) && (ip->firstUnit > 0)) {
10991099
parts[0].name = " DiskOnChip IPL / Media Header partition";
11001100
parts[0].offset = 0;
1101-
parts[0].size = mtd->erasesize * ip->firstUnit;
1101+
parts[0].size = (uint64_t)mtd->erasesize * ip->firstUnit;
11021102
numparts = 1;
11031103
}
11041104

0 commit comments

Comments
 (0)