summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2014-06-12 13:24:44 (GMT)
committerTom Rini <trini@ti.com>2014-06-19 15:18:57 (GMT)
commitba923cab0006838eb726e40207501ddf16eabd80 (patch)
treeb2dd16ab8f817b5768a531caf73a63085e22e5b1
parentd18926af30d111362c6262c356feb768d7a367a3 (diff)
downloadu-boot-ba923cab0006838eb726e40207501ddf16eabd80.tar.xz
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: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
-rw-r--r--tools/fit_check_sign.c9
-rw-r--r--tools/fit_info.c12
2 files changed, 21 insertions, 0 deletions
diff --git a/tools/fit_check_sign.c b/tools/fit_check_sign.c
index af257cc..e1198bc 100644
--- a/tools/fit_check_sign.c
+++ b/tools/fit_check_sign.c
@@ -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;
diff --git a/tools/fit_info.c b/tools/fit_info.c
index afbed7b..481ac6d 100644
--- a/tools/fit_info.c
+++ b/tools/fit_info.c
@@ -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) {