mirror of
https://git.codelinaro.org/clo/qsdk/oss/boot/u-boot-2016.git
synced 2026-03-06 17:30:35 +01:00
Tidy up error checking and fix bug in hash command
There are two problems: 1. The argument count needs to be checked before argv is used 2. When verify is not enabled, we need to define a constant zero value Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
8ec21bbe5c
commit
6b3ff98da4
1 changed files with 4 additions and 0 deletions
|
|
@ -32,11 +32,15 @@ static int do_hash(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|||
#ifdef CONFIG_HASH_VERIFY
|
||||
int verify = 0;
|
||||
|
||||
if (argc < 4)
|
||||
return CMD_RET_USAGE;
|
||||
if (!strcmp(argv[1], "-v")) {
|
||||
verify = 1;
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
#else
|
||||
const int verify = 0;
|
||||
#endif
|
||||
/* Move forward to 'algorithm' parameter */
|
||||
argc--;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue