tools: imx8image: fix coverity CID 184234
Fix:
CID 184234: (TAINTED_SCALAR)
Using tainted variable "header.num_images - 1" as an index into an array "header.img".
Reported-by: Coverity
Signed-off-by: Peng Fan <peng.fan@nxp.com>
diff --git a/tools/imx8image.c b/tools/imx8image.c
index 03debe5..019b875 100644
--- a/tools/imx8image.c
+++ b/tools/imx8image.c
@@ -666,8 +666,10 @@
}
ret = fread(&header, sizeof(header), 1, fd);
- if (ret != 1)
+ if (ret != 1) {
printf("Failure Read header %d\n", ret);
+ exit(EXIT_FAILURE);
+ }
fclose(fd);