[PATCH 1/1] cmd: undefined return value of do_extension_apply()

If 'extension apply all' is executed and no extension is found, the return value of do_extension_apply() is undefined. Return CMD_RET_FAILURE in this case.
Fixes: 2f84e9cf06d3 ("cmd: add support for a new "extension" command") Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- cmd/extension_board.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/cmd/extension_board.c b/cmd/extension_board.c index bbb4812ff8..f94abd612d 100644 --- a/cmd/extension_board.c +++ b/cmd/extension_board.c @@ -111,6 +111,7 @@ static int do_extension_apply(struct cmd_tbl *cmdtp, int flag, return CMD_RET_USAGE;
if (strcmp(argv[1], "all") == 0) { + ret = CMD_RET_FAILURE; list_for_each_entry(extension, &extension_list, list) { ret = extension_apply(extension); if (ret != CMD_RET_SUCCESS)

Hello Heinrich,
On Mon, 11 Jul 2022 20:01:12 +0200 Heinrich Schuchardt heinrich.schuchardt@canonical.com wrote:
If 'extension apply all' is executed and no extension is found, the return value of do_extension_apply() is undefined. Return CMD_RET_FAILURE in this case.
Fixes: 2f84e9cf06d3 ("cmd: add support for a new "extension" command") Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com
Reviewed-by: Kory Maincent kory.maincent@bootlin.com
cmd/extension_board.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/cmd/extension_board.c b/cmd/extension_board.c index bbb4812ff8..f94abd612d 100644 --- a/cmd/extension_board.c +++ b/cmd/extension_board.c @@ -111,6 +111,7 @@ static int do_extension_apply(struct cmd_tbl *cmdtp, int flag, return CMD_RET_USAGE;
if (strcmp(argv[1], "all") == 0) {
list_for_each_entry(extension, &extension_list, list) { ret = extension_apply(extension); if (ret != CMD_RET_SUCCESS)ret = CMD_RET_FAILURE;
Thanks, Köry

On Mon, Jul 11, 2022 at 08:01:12PM +0200, Heinrich Schuchardt wrote:
If 'extension apply all' is executed and no extension is found, the return value of do_extension_apply() is undefined. Return CMD_RET_FAILURE in this case.
Fixes: 2f84e9cf06d3 ("cmd: add support for a new "extension" command") Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com Reviewed-by: Kory Maincent kory.maincent@bootlin.com
Applied to u-boot/master, thanks!
participants (3)
-
Heinrich Schuchardt
-
Köry Maincent
-
Tom Rini