imx: image-container: Fix container header checking
authorYe Li <ye.li@nxp.com>
Thu, 15 Jun 2023 10:09:16 +0000 (18:09 +0800)
committerStefano Babic <sbabic@denx.de>
Thu, 13 Jul 2023 09:29:40 +0000 (11:29 +0200)
Checking container header tag and version is wrong, it causes to fail
to bypass invalid container

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
arch/arm/mach-imx/image-container.c

index 5b059a6..745de13 100644 (file)
@@ -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;
        }