[PATCH 06/13] imx: nandbcb: Fix potential overflow in nandbcb_set_boot_config

Peng Fan (OSS) peng.fan at oss.nxp.com
Thu Jan 14 08:28:03 CET 2021


From: Ye Li <ye.li at nxp.com>

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 at nxp.com>
Reviewed-by: Peng Fan <peng.fan at nxp.com>
Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
 arch/arm/mach-imx/cmd_nandbcb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/cmd_nandbcb.c b/arch/arm/mach-imx/cmd_nandbcb.c
index ea4e147da8..028b7c4835 100644
--- a/arch/arm/mach-imx/cmd_nandbcb.c
+++ b/arch/arm/mach-imx/cmd_nandbcb.c
@@ -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;
 
-- 
2.28.0



More information about the U-Boot mailing list