[PATCH 1/2] cmd: hash: correct parameter count check
Igor Opaniuk
igor.opaniuk at gmail.com
Sun Nov 3 10:54:02 CET 2024
Hi Heinrich,
On Sat, Nov 2, 2024 at 11:09 AM Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
> Since commit 348ea878508d ("cmd: hash: fix param count check") the hash
> command cannot be used without the optional variable name parameter if
> CONFIG_HASH_VERIFY=y. 'hash sha1 $loadaddr $filesize' returns
> CMD_RET_USAGE.
>
> The minimum number of arguments is four no matter if verification is
> enabled or not.
>
> Fixes: 348ea878508d ("cmd: hash: fix param count check")
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> ---
> cmd/hash.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/cmd/hash.c b/cmd/hash.c
> index 60d482b7f87..5b40982b098 100644
> --- a/cmd/hash.c
> +++ b/cmd/hash.c
> @@ -25,7 +25,7 @@ static int do_hash(struct cmd_tbl *cmdtp, int flag, int argc,
> char *s;
> int flags = HASH_FLAG_ENV;
>
> - if (argc < (HARGS - 1))
> + if (argc < 4)
> return CMD_RET_USAGE;
>
> #if IS_ENABLED(CONFIG_HASH_VERIFY)
> --
> 2.45.2
>
Reviewed-by: Igor Opaniuk <igor.opaniuk at gmail.com>
--
Best regards - Atentamente - Meilleures salutations
Igor Opaniuk
mailto: igor.opaniuk at gmail.com
skype: igor.opanyuk
https://www.linkedin.com/in/iopaniuk
More information about the U-Boot
mailing list