]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
imx: nandbcb: Fix potential overflow in fill_dbbt_data
authorYe Li <ye.li@nxp.com>
Mon, 3 Aug 2020 05:59:43 +0000 (22:59 -0700)
committerStefano Babic <sbabic@denx.de>
Sat, 23 Jan 2021 10:30:31 +0000 (11:30 +0100)
Fix Coverity Issue 9006658. In fill_dbbt_data, an integer overflow occurs,
with the result converted to a wider integer type

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
arch/arm/mach-imx/cmd_nandbcb.c

index 836981c89572fbac7450413bd73c49913981982d..ea4e147da873a3e575e687989d73f423bc6f5e78 100644 (file)
@@ -476,7 +476,7 @@ static int fill_dbbt_data(struct mtd_info *mtd, void *buf, int num_blocks)
        u32 *n_bad_blocksp = buf + 0x4;
 
        for (n = 0; n < num_blocks; n++) {
-               loff_t offset = n * mtd->erasesize;
+               loff_t offset = (loff_t)n * mtd->erasesize;
                        if (mtd_block_isbad(mtd, offset)) {
                                n_bad_blocks++;
                                *bb = n;