"Das U-Boot" Source Tree
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

boot: menu: Do not dereference pointer if pointer is NULL

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.

Also add a NULL check for str.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

authored by

Andrew Goodbody and committed by
Tom Rini
074e0595 c3b43eea

+3 -2
+3 -2
boot/scene_menu.c
··· 571 571 return log_msg_ret("txt", -EINVAL); 572 572 573 573 str = expo_get_str(exp, txt->gen.str_id); 574 - printf("%s\n\n", str); 574 + printf("%s\n\n", str ? str : ""); 575 575 } 576 576 577 577 if (list_empty(&menu->item_head)) 578 578 return 0; 579 579 580 580 pointer = scene_obj_find(scn, menu->pointer_id, SCENEOBJT_TEXT); 581 - pstr = expo_get_str(scn->expo, pointer->gen.str_id); 581 + if (pointer) 582 + pstr = expo_get_str(scn->expo, pointer->gen.str_id); 582 583 583 584 list_for_each_entry(item, &menu->item_head, sibling) { 584 585 struct scene_obj_txt *key = NULL, *label = NULL;