projects
/
profile
/
common
/
platform
/
kernel
/
u-boot-artik.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6aa156a
)
Tidy up error checking and fix bug in hash command
author
Simon Glass
<sjg@chromium.org>
Sun, 24 Feb 2013 17:33:11 +0000
(17:33 +0000)
committer
Chanho Park
<chanho61.park@samsung.com>
Mon, 27 Jul 2015 01:16:52 +0000
(10:16 +0900)
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>
common/cmd_hash.c
patch
|
blob
|
history
diff --git
a/common/cmd_hash.c
b/common/cmd_hash.c
index 689c60857249d85ce297f66ce278d2f6d99cef5a..eb6a33873b484a8837476f1d6c6759f1bd5bbe7d 100644
(file)
--- a/
common/cmd_hash.c
+++ b/
common/cmd_hash.c
@@
-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--;