mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] bootm: fix uImage crashes when no partition is given
@ 2016-02-26 19:12 Lucas Stach
  2016-02-26 19:12 ` [PATCH 2/3] arm: bootm: unify kernel load address calculation Lucas Stach
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Lucas Stach @ 2016-02-26 19:12 UTC (permalink / raw)
  To: barebox

From: Lucas Stach <l.stach@pengutronix.de>

Before the conversion to use the partition string instead of a plain
integer the default was partition 0, now it's just a NULL pointer.

There are a lot of places where strtoul is called on the partition string
which crashes when encountering the NULL pointer. Instead of fixing all
those places, plug in a default partition string that matches the old
behavior by picking partition 0.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 common/bootm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/common/bootm.c b/common/bootm.c
index 7d00f8e..1f99b61 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -465,6 +465,8 @@ static void bootm_print_info(struct image_data *data)
 		printf("OS image not yet relocated\n");
 }
 
+static char part_zero[] = "0";
+
 static int bootm_image_name_and_part(const char *name, char **filename, char **part)
 {
 	char *at, *ret;
@@ -475,7 +477,7 @@ static int bootm_image_name_and_part(const char *name, char **filename, char **p
 	ret = xstrdup(name);
 
 	*filename = ret;
-	*part = NULL;
+	*part = part_zero;
 
 	at = strchr(ret, '@');
 	if (!at)
-- 
2.5.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-03-01  7:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-26 19:12 [PATCH 1/3] bootm: fix uImage crashes when no partition is given Lucas Stach
2016-02-26 19:12 ` [PATCH 2/3] arm: bootm: unify kernel load address calculation Lucas Stach
2016-02-26 19:12 ` [PATCH 3/3] arm: bootm: be more clever about kernel spacing Lucas Stach
2016-02-29  7:48 ` [PATCH 1/3] bootm: fix uImage crashes when no partition is given Sascha Hauer
2016-02-29  9:05   ` Lucas Stach
2016-03-01  7:23     ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox