[PATCH] blspec: Fix another crash with menu disabled

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Thu Nov 7 05:48:05 EST 2013


boot -l crashes with CONFIG_MENU disabled because blspec_alloc returns
with blspec->menu being NULL in this case. So guard the usage of
blspec->menu accordingly.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
---
 commands/boot.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/commands/boot.c b/commands/boot.c
index 8105889..cce4c30 100644
--- a/commands/boot.c
+++ b/commands/boot.c
@@ -87,7 +87,10 @@ static struct blspec *bootentries_collect(void)
 	struct blspec *blspec;
 
 	blspec = blspec_alloc();
-	blspec->menu->display = asprintf("boot");
+
+	if (IS_ENABLED(CONFIG_MENU))
+		blspec->menu->display = asprintf("boot");
+
 	bootsources_menu_env_entries(blspec);
 	if (IS_ENABLED(CONFIG_BLSPEC))
 		blspec_scan_devices(blspec);
-- 
1.8.4.rc3




More information about the barebox mailing list