[U-Boot] [PATCH 3/4] tools: imx8image: fix coverity CID 184233
Peng Fan
peng.fan at nxp.com
Thu Nov 1 06:42:09 UTC 2018
Fix:
CID 184233: (NEGATIVE_RETURNS)
Using variable "container" as an index to array "imx_header.fhdr".
Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
tools/imx8image.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/imx8image.c b/tools/imx8image.c
index 06b72ea989..f3d1658f11 100644
--- a/tools/imx8image.c
+++ b/tools/imx8image.c
@@ -808,6 +808,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],
@@ -821,6 +825,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],
--
2.14.1
More information about the U-Boot
mailing list