提交 a9f7f1c5 编写于 作者: P Peng Fan 提交者: Stefano Babic

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: NPeng Fan <peng.fan@nxp.com>
上级 df439e93
...@@ -812,6 +812,10 @@ static int build_container(soc_type_t soc, uint32_t sector_size, ...@@ -812,6 +812,10 @@ static int build_container(soc_type_t soc, uint32_t sector_size,
case SCFW: case SCFW:
case DATA: case DATA:
case MSG_BLOCK: case MSG_BLOCK:
if (container < 0) {
fprintf(stderr, "No container found\n");
exit(EXIT_FAILURE);
}
check_file(&sbuf, img_sp->filename); check_file(&sbuf, img_sp->filename);
tmp_filename = img_sp->filename; tmp_filename = img_sp->filename;
set_image_array_entry(&imx_header.fhdr[container], set_image_array_entry(&imx_header.fhdr[container],
...@@ -825,6 +829,10 @@ static int build_container(soc_type_t soc, uint32_t sector_size, ...@@ -825,6 +829,10 @@ static int build_container(soc_type_t soc, uint32_t sector_size,
break; break;
case SECO: case SECO:
if (container < 0) {
fprintf(stderr, "No container found\n");
exit(EXIT_FAILURE);
}
check_file(&sbuf, img_sp->filename); check_file(&sbuf, img_sp->filename);
tmp_filename = img_sp->filename; tmp_filename = img_sp->filename;
set_image_array_entry(&imx_header.fhdr[container], set_image_array_entry(&imx_header.fhdr[container],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册