Commit ba923cab authored by Simon Glass's avatar Simon Glass Committed by Tom Rini

tools: Check arguments in fit_check_sign/fit_info

These tools crash if no arguments are provided. Add checks to avoid this.
Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
Acked-by: default avatarHeiko Schocher <hs@denx.de>
parent d18926af
......@@ -62,6 +62,15 @@ int main(int argc, char **argv)
break;
}
if (!fdtfile) {
fprintf(stderr, "%s: Missing fdt file\n", *argv);
usage(*argv);
}
if (!keyfile) {
fprintf(stderr, "%s: Missing key file\n", *argv);
usage(*argv);
}
ffd = mmap_fdt(cmdname, fdtfile, 0, &fit_blob, &fsbuf, false);
if (ffd < 0)
return EXIT_FAILURE;
......
......@@ -68,6 +68,18 @@ int main(int argc, char **argv)
break;
}
if (!fdtfile) {
fprintf(stderr, "%s: Missing fdt file\n", *argv);
usage(*argv);
}
if (!nodename) {
fprintf(stderr, "%s: Missing node name\n", *argv);
usage(*argv);
}
if (!propertyname) {
fprintf(stderr, "%s: Missing property name\n", *argv);
usage(*argv);
}
ffd = mmap_fdt(cmdname, fdtfile, 0, &fit_blob, &fsbuf, false);
if (ffd < 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment