[U-Boot] [PATCH] tools: mkimage: Check for datafile when type is script

Alex Kiernan alex.kiernan at gmail.com
Sun Apr 22 05:11:17 UTC 2018


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 at gmail.com>
---

 tools/mkimage.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/mkimage.c b/tools/mkimage.c
index 4e56182..32e07be 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -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;
 	}
 
-- 
2.7.4



More information about the U-Boot mailing list