diff mbox series

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

Message ID 1524373877-13207-1-git-send-email-alex.kiernan@gmail.com
State Accepted
Commit 8c84287a0f225e29b688bda848e49a555c68a442
Delegated to: Tom Rini
Headers show
Series [U-Boot] tools: mkimage: Check for datafile when type is script | expand

Commit Message

Alex Kiernan April 22, 2018, 5:11 a.m. UTC
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 | 2 ++
 1 file changed, 2 insertions(+)

Comments

Tom Rini April 29, 2018, 9:04 p.m. UTC | #1
On Sun, Apr 22, 2018 at 05:11:17AM +0000, Alex Kiernan wrote:

> 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>

Applied to u-boot/master, thanks!
diff mbox series

Patch

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;
 	}