[PATCH] boot: bootflow: Ensure sel_id is initialised before use

Andrew Goodbody andrew.goodbody at linaro.org
Mon Jun 30 15:25:44 CEST 2025


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.

Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
---
 boot/bootflow_menu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/boot/bootflow_menu.c b/boot/bootflow_menu.c
index 9d0dc352f97..58899a83295 100644
--- a/boot/bootflow_menu.c
+++ b/boot/bootflow_menu.c
@@ -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,
-- 
Andrew Goodbody <andrew.goodbody at linaro.org>



More information about the U-Boot mailing list