[PATCH] boot: menu: Do not dereference pointer if pointer is NULL
Andrew Goodbody
andrew.goodbody at linaro.org
Mon Jun 30 18:06:07 CEST 2025
scene_obj_find can return NULL but this is not checked for before
the return is dereferenced. Add a NULL check.
This issue was found by Smatch.
Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
---
boot/scene_menu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/boot/scene_menu.c b/boot/scene_menu.c
index 17150af145d..9a6e37d1c64 100644
--- a/boot/scene_menu.c
+++ b/boot/scene_menu.c
@@ -508,7 +508,8 @@ int scene_menu_display(struct scene_obj_menu *menu)
return 0;
pointer = scene_obj_find(scn, menu->pointer_id, SCENEOBJT_TEXT);
- pstr = expo_get_str(scn->expo, pointer->str_id);
+ if (pointer)
+ pstr = expo_get_str(scn->expo, pointer->str_id);
list_for_each_entry(item, &menu->item_head, sibling) {
struct scene_obj_txt *key = NULL, *label = NULL;
---
base-commit: 7027b445cc0bfb86204ecb1f1fe596f5895048d9
change-id: 20250630-scene_menu_fix-60640ea67c20
Best regards,
--
Andrew Goodbody <andrew.goodbody at linaro.org>
More information about the U-Boot
mailing list