public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 1/1] mkimage: error handling for FIT image
@ 2022-03-01  7:53 Heinrich Schuchardt
  2022-03-05 16:35 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2022-03-01  7:53 UTC (permalink / raw)
  To: Tom Rini
  Cc: Simon Glass, Jan Kiszka, Mark Kettenis, Pali Rohár,
	Alexandru Gagniuc, Thomas Hebb, Yann Dirson, u-boot,
	Heinrich Schuchardt

If parameter -F is given but FIT support is missing, a NULL pointer might
dereferenced (Coverity CID 350249).

If incorrect parameters are given, provide a message and show usage.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 tools/mkimage.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/mkimage.c b/tools/mkimage.c
index 760145119d..74bd072832 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -381,6 +381,11 @@ int main(int argc, char **argv)
 	}
 
 	if (params.fflag){
+		if (!tparams) {
+			fprintf(stderr, "%s: Missing FIT support\n",
+				params.cmdname);
+			exit (EXIT_FAILURE);
+		}
 		if (tparams->fflag_handle)
 			/*
 			 * in some cases, some additional processing needs
@@ -391,7 +396,7 @@ int main(int argc, char **argv)
 			retval = tparams->fflag_handle(&params);
 
 		if (retval != EXIT_SUCCESS)
-			exit (retval);
+			usage("Bad parameters for FIT image type");
 	}
 
 	if (params.lflag || params.fflag) {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-05 16:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-01  7:53 [PATCH 1/1] mkimage: error handling for FIT image Heinrich Schuchardt
2022-03-05 16:35 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox