summaryrefslogtreecommitdiff
path: root/tools/imx8image.c
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2018-11-05 09:53:28 +0000
committerStefano Babic <sbabic@denx.de>2018-11-06 11:23:59 +0100
commita9f7f1c58535af68efda0127322de30a33dd31b7 (patch)
tree3edeeca63d4afcc605600a88132128eec41273f0 /tools/imx8image.c
parentdf439e938ceb5165297c3e34b6485af0238608ef (diff)
tools: imx8image: fix coverity CID 184233
Fix: CID 184233: (NEGATIVE_RETURNS) Using variable "container" as an index to array "imx_header.fhdr". Reported-by: Coverity Signed-off-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'tools/imx8image.c')
-rw-r--r--tools/imx8image.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/imx8image.c b/tools/imx8image.c
index 019b875773..ac89c821c9 100644
--- a/tools/imx8image.c
+++ b/tools/imx8image.c
@@ -812,6 +812,10 @@ static int build_container(soc_type_t soc, uint32_t sector_size,
case SCFW:
case DATA:
case MSG_BLOCK:
+ if (container < 0) {
+ fprintf(stderr, "No container found\n");
+ exit(EXIT_FAILURE);
+ }
check_file(&sbuf, img_sp->filename);
tmp_filename = img_sp->filename;
set_image_array_entry(&imx_header.fhdr[container],
@@ -825,6 +829,10 @@ static int build_container(soc_type_t soc, uint32_t sector_size,
break;
case SECO:
+ if (container < 0) {
+ fprintf(stderr, "No container found\n");
+ exit(EXIT_FAILURE);
+ }
check_file(&sbuf, img_sp->filename);
tmp_filename = img_sp->filename;
set_image_array_entry(&imx_header.fhdr[container],