]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
imx: nandbcb: Fix potential overflow in nandbcb_set_boot_config
authorYe Li <ye.li@nxp.com>
Mon, 3 Aug 2020 06:07:55 +0000 (23:07 -0700)
committerStefano Babic <sbabic@denx.de>
Sat, 23 Jan 2021 10:30:31 +0000 (11:30 +0100)
Fix Coverity Issue 9006656. In nandbcb_set_boot_config, 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 ea4e147da873a3e575e687989d73f423bc6f5e78..028b7c4835f9869204344f7b68ac0cf823c46078 100644 (file)
@@ -275,7 +275,8 @@ static int nandbcb_set_boot_config(int argc, char * const argv[],
                               boot_stream1_address);
 
        if (boot_cfg->secondary_boot_stream_off_in_MB)
-               boot_stream2_address = boot_cfg->secondary_boot_stream_off_in_MB * 1024 * 1024;
+               boot_stream2_address =
+                       (loff_t)boot_cfg->secondary_boot_stream_off_in_MB * 1024 * 1024;
 
        max_boot_stream_size = boot_stream2_address - boot_stream1_address;