[PATCH V2 19/30] imx: image-container: Fix container header checking

Peng Fan (OSS) peng.fan at oss.nxp.com
Thu Jun 15 12:09:16 CEST 2023


From: Ye Li <ye.li at nxp.com>

Checking container header tag and version is wrong, it causes to fail
to bypass invalid container

Reviewed-by: Peng Fan <peng.fan at nxp.com>
Signed-off-by: Ye Li <ye.li at nxp.com>
Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
 arch/arm/mach-imx/image-container.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/image-container.c b/arch/arm/mach-imx/image-container.c
index 5b059a64292..745de130630 100644
--- a/arch/arm/mach-imx/image-container.c
+++ b/arch/arm/mach-imx/image-container.c
@@ -31,7 +31,7 @@ int get_container_size(ulong addr, u16 *header_length)
 	u32 max_offset = 0, img_end;
 
 	phdr = (struct container_hdr *)addr;
-	if (phdr->tag != 0x87 && phdr->version != 0x0) {
+	if (phdr->tag != 0x87 || phdr->version != 0x0) {
 		debug("Wrong container header\n");
 		return -EFAULT;
 	}
-- 
2.40.0



More information about the U-Boot mailing list