From: Peng Fan Date: Thu, 1 Nov 2018 06:42:05 +0000 Subject: [U-Boot] [PATCH 2/4] tools: imx8image: fix coverity CID 184234 In-Reply-To: <20181101064937.28731-1-peng.fan@nxp.com> References: <20181101064937.28731-1-peng.fan@nxp.com> Message-ID: <20181101064937.28731-2-peng.fan@nxp.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Fix: CID 184234: (TAINTED_SCALAR) Using tainted variable "header.num_images - 1" as an index into an array "header.img". Signed-off-by: Peng Fan --- tools/imx8image.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/imx8image.c b/tools/imx8image.c index eb039b583d..06b72ea989 100644 --- a/tools/imx8image.c +++ b/tools/imx8image.c @@ -663,8 +663,10 @@ static int get_container_image_start_pos(image_t *image_stack, uint32_t align) } 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); -- 2.14.1