Commit d1583963 authored by Ye Li's avatar Ye Li

MLK-20239-3 imx8qm/qxp: Add check for container array index

Fix coverity issue CID 3327493: Negative array index read (NEGATIVE_RETURNS)
negative_returns: Using variable container as an index to array imx_header.fhdr
Signed-off-by: default avatarYe Li <ye.li@nxp.com>
parent 3b2ed51e
......@@ -577,6 +577,10 @@ int build_container_qx_qm_b0(soc_type_t soc, uint32_t sector_size, uint32_t ivt_
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],
......@@ -594,6 +598,10 @@ int build_container_qx_qm_b0(soc_type_t soc, uint32_t sector_size, uint32_t ivt_
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],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment