diff mbox

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

Message ID 1448355263-545-1-git-send-email-Peng.Fan@freescale.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Peng Fan Nov. 24, 2015, 8:54 a.m. UTC
Before continue, check return value of strict_strtoul.

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

Comments

Simon Glass Nov. 24, 2015, 7:04 p.m. UTC | #1
On 24 November 2015 at 01:54, Peng Fan <Peng.Fan@freescale.com> wrote:
> Before continue, check return value of strict_strtoul.
>
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> Cc: Albert Aribaud <albert.u.boot@aribaud.net>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Jan Kiszka <jan.kiszka@siemens.com>
> Cc: Joe Hershberger <joe.hershberger@ni.com>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: York Sun <yorksun@freescale.com>
> Cc: Tom Rini <trini@konsulko.com>
> ---
>  arch/arm/lib/bootm.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Tom Rini Dec. 6, 2015, 10:05 p.m. UTC | #2
On Tue, Nov 24, 2015 at 04:54:20PM +0800, Peng Fan wrote:

> Before continue, check return value of strict_strtoul.
> 
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> Cc: Albert Aribaud <albert.u.boot@aribaud.net>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Jan Kiszka <jan.kiszka@siemens.com>
> Cc: Joe Hershberger <joe.hershberger@ni.com>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: York Sun <yorksun@freescale.com>
> Cc: Tom Rini <trini@konsulko.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox

Patch

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);
 	}