diff options
author | Heinrich Schuchardt | 2022-03-01 08:53:56 +0100 |
---|---|---|
committer | Tom Rini | 2022-03-04 15:20:06 -0500 |
commit | 5017f9b595da6e5c8f064a43fc6cd42cb62c082a (patch) | |
tree | bee8f82a0250f724954434b5a5eb19fc8c178ced | |
parent | 55fd1c442e747338604ef0075a4a888a40399ddc (diff) |
mkimage: error handling for FIT image
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>
-rw-r--r-- | tools/mkimage.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/mkimage.c b/tools/mkimage.c index 760145119dc..74bd072832c 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(¶ms); if (retval != EXIT_SUCCESS) - exit (retval); + usage("Bad parameters for FIT image type"); } if (params.lflag || params.fflag) { |