From 8d628654111705c5cbba4eba2ddc72673c98c8be Mon Sep 17 00:00:00 2001 From: Ye Li Date: Tue, 21 Nov 2017 20:37:21 -0600 Subject: [PATCH] MLK-16931 imx8m: hab: Fix secure boot build warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Found HAB build warnings on mScale, those relate to ARM 64 bits conversion. arch/arm/imx-common/hab.c: In function ‘csf_is_valid’: arch/arm/imx-common/hab.c:556:18: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] !chk_bounds((const uint8_t *)ivt_initial->csf, ^ In file included from arch/arm/imx-common/hab.c:14:0: arch/arm/imx-common/hab.c:557:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] HAB_HDR_LEN(*(const struct hab_hdr *)ivt_initial->csf), ^ ./arch/arm/include/asm/imx-common/hab.h:177:40: note: in definition of macro ‘HAB_HDR_LEN’ ((size_t)(((const struct hab_hdr *)&(hdr))->len[0] << 8) \ ^~~ arch/arm/imx-common/hab.c:557:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] HAB_HDR_LEN(*(const struct hab_hdr *)ivt_initial->csf), ^ ./arch/arm/include/asm/imx-common/hab.h:178:41: note: in definition of macro ‘HAB_HDR_LEN’ + (size_t)((const struct hab_hdr *)&(hdr))->len[1]) ^~~ arch/arm/imx-common/hab.c:563:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] csf_hdr = (const uint8_t *)ivt_initial->csf; Signed-off-by: Ye Li Reviewed-by: Peng Fan --- arch/arm/imx-common/hab.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/imx-common/hab.c b/arch/arm/imx-common/hab.c index dfda5ee771..c4680f189b 100644 --- a/arch/arm/imx-common/hab.c +++ b/arch/arm/imx-common/hab.c @@ -554,14 +554,14 @@ static int csf_is_valid(int ivt_offset, ulong start_addr, size_t bytes) /* Check that the CSF lies within the image bounds */ if ((start == 0) || (ivt_initial == NULL) || (ivt_initial->csf == 0) || - !chk_bounds((const uint8_t *)ivt_initial->csf, - HAB_HDR_LEN(*(const struct hab_hdr *)ivt_initial->csf), + !chk_bounds((const uint8_t *)(ulong)ivt_initial->csf, + HAB_HDR_LEN(*(const struct hab_hdr *)(ulong)ivt_initial->csf), start, end)) { puts("Error - CSF lies outside the image bounds\n"); return 0; } - csf_hdr = (const uint8_t *)ivt_initial->csf; + csf_hdr = (const uint8_t *)(ulong)ivt_initial->csf; if (*csf_hdr == HAB_CMD_HDR) { csf_hdr_len = HAB_HDR_LEN(*(const struct hab_hdr *)csf_hdr); -- 2.17.1