[U-Boot] [PATCH] common: bootm: check return value of strict_strtoul

Peng Fan Peng.Fan at freescale.com
Tue Nov 24 09:54:20 CET 2015


Before continue, check return value of strict_strtoul.

Signed-off-by: Peng Fan <Peng.Fan at freescale.com>
Cc: Albert Aribaud <albert.u.boot at aribaud.net>
Cc: Simon Glass <sjg at chromium.org>
Cc: Jan Kiszka <jan.kiszka at siemens.com>
Cc: Joe Hershberger <joe.hershberger at ni.com>
Cc: Hans de Goede <hdegoede at redhat.com>
Cc: York Sun <yorksun at freescale.com>
Cc: Tom Rini <trini at konsulko.com>
---
 arch/arm/lib/bootm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index ee56d74..a477cae 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -290,7 +290,10 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)
 
 	s = getenv("machid");
 	if (s) {
-		strict_strtoul(s, 16, &machid);
+		if (strict_strtoul(s, 16, &machid) < 0) {
+			debug("strict_strtoul failed!\n");
+			return;
+		}
 		printf("Using machid 0x%lx from environment\n", machid);
 	}
 
-- 
2.6.2




More information about the U-Boot mailing list