Skip to contentSkip to conversation

boot: bootflow: Ensure sel_id is initialised before use

PATCH In review Andrew Goodbody 2 participants 4 messages Jun 30, 2025 – Jul 9, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 boot: bootflow: Ensure sel_id is initialised before use

sel_id is only assigned to in the case of EXPOACT_SELECT, anything else will leave sel_id uninitialised. Initialise it on declaration to ensure that it is always valid.

This issue was found with Smatch.

---
 boot/bootflow_menu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
boot/bootflow_menu.c +1 -1
index 9d0dc352f97..58899a83295 100644
@@ -182,7 +182,7 @@ int bootflow_menu_run(struct bootstd_priv *std, bool text_mode,
 	struct bootflow *sel_bflow;
 	struct udevice *dev;
 	struct expo *exp;
-	uint sel_id;
+	uint sel_id = 0;
 	bool done;
 	int ret;
 

---
base-commit: 7027b445cc0bfb86204ecb1f1fe596f5895048d9
change-id: 20250630-bootflow_menu_fix-4ea403f596dd

Best regards,

Signature · 1 line
Andrew Goodbody <[email protected]>
#1 lore raw
Quoted 10 lines · Andrew Goodbody

sel_id is only assigned to in the case of EXPOACT_SELECT, anything else will leave sel_id uninitialised. Initialise it on declaration to ensure that it is always valid.

This issue was found with Smatch.

---
 boot/bootflow_menu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Can you please rebase this on current master? Thanks.

Signature · 1 line
Tom
#2 lore raw
Quoted 6 lines · Tom Rini
Quoted 4 lines · Andrew Goodbody

sel_id is only assigned to in the case of EXPOACT_SELECT, anything else will leave sel_id uninitialised. Initialise it on declaration to ensure that it is always valid.

Quoted 8 lines
Quoted 6 lines

This issue was found with Smatch.

---
  boot/bootflow_menu.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Can you please rebase this on current master? Thanks.

The patch is no longer relevant with all the changes. Just drop it.

Andrew

#3 lore raw
Quoted 9 lines · Andrew Goodbody
Quoted 8 lines · Tom Rini
Quoted 6 lines · Andrew Goodbody

sel_id is only assigned to in the case of EXPOACT_SELECT, anything else will leave sel_id uninitialised. Initialise it on declaration to ensure that it is always valid.

This issue was found with Smatch.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
---
  boot/bootflow_menu.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Can you please rebase this on current master? Thanks.

The patch is no longer relevant with all the changes. Just drop it.

OK, thanks.

Signature · 1 line
Tom