]> git.sur5r.net Git - u-boot/commitdiff
tools: mkimage: Check for datafile when type is script
authorAlex Kiernan <alex.kiernan@gmail.com>
Sun, 22 Apr 2018 05:11:17 +0000 (05:11 +0000)
committerTom Rini <trini@konsulko.com>
Sat, 28 Apr 2018 22:32:25 +0000 (18:32 -0400)
If generating a script image and no datafile has been passed in, mkimage
dies with SIGSEGV:

  #0  __strchr_sse2 () at ../sysdeps/x86_64/multiarch/../strchr.S:32
  #1  0x0000000000403818 in main
      at tools/mkimage.c:503

Add explicit test for datafile to fix this.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
tools/mkimage.c

index 4e561820e7723597a46d3804cad3a236522e9e69..32e07be94af3b0e809e5807ef12d3ce8e01a48b0 100644 (file)
@@ -301,6 +301,8 @@ static void process_args(int argc, char **argv)
                else if (!params.datafile)
                        usage("Missing data file for auto-FIT (use -d)");
        } else if (type != IH_TYPE_INVALID) {
+               if (type == IH_TYPE_SCRIPT && !params.datafile)
+                       usage("Missing data file for script (use -d)");
                params.type = type;
        }