From d401e0b264a21e94a96074ce66c5f8df275cccbe Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Sat, 14 Oct 2023 16:47:43 -0400 Subject: arm: imx: Add function to validate i.MX8 containers Add a function to abstract the common task of validating i.MX8 container image headers. Signed-off-by: Sean Anderson --- arch/arm/mach-imx/spl_imx_romapi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'arch/arm/mach-imx/spl_imx_romapi.c') diff --git a/arch/arm/mach-imx/spl_imx_romapi.c b/arch/arm/mach-imx/spl_imx_romapi.c index c4a4185eed1..80909aec3ea 100644 --- a/arch/arm/mach-imx/spl_imx_romapi.c +++ b/arch/arm/mach-imx/spl_imx_romapi.c @@ -202,7 +202,8 @@ static u8 *search_container_header(u8 *p, int size) for (i = 0; i < size; i += 4) { hdr = p + i; - if (*(hdr + 3) == 0x87 && *hdr == 0 && (*(hdr + 1) != 0 || *(hdr + 2) != 0)) + if (valid_container_hdr((void *)hdr) && + (*(hdr + 1) != 0 || *(hdr + 2) != 0)) return p + i; } -- cgit v1.2.3