Commit d7b3da671ea09d7b0cf7fbf9077f3f0a28a8d4dd
Committed by
Ye Li
1 parent
6bf8976410
Exists in
smarc_8mm-imx_v2019.04_4.19.35_1.1.0
and in
1 other branch
MLK-20893: imx: in_le32 out_le32 preprocessor casting issue with addresses involving math
The sec_in32 preprocessor is defined as follows in include/fsl_sec.h file: When address "a" is calculated using math for ex: addition of base address and an offset, then casting is applied only to the first address which in this example is base address. caam_ccbvid_reg = sec_in32(CONFIG_SYS_FSL_SEC_ADDR + CAAM_CCBVID_OFFSET) resolves to: caam_ccbvid_reg = in_le32((ulong *)(ulong)CONFIG_SYS_FSL_SEC_ADDR + CAAM_CCBVID_OFFSET) instead it should resolve to: caam_ccbvid_reg = in_le32((ulong *)(ulong)(CONFIG_SYS_FSL_SEC_ADDR + CAAM_CCBVID_OFFSET)) Thus add parenthesis around the address "a" so that however the address is calculated, the casting is applied to the final calculated address. Bug introduced by commit 79e90af14af3 ("MLK-18044-2: crypto: caam: Fix build warnings pointer casting"). Signed-off-by: Utkarsh Gupta <utkarsh.gupta@nxp.com> Reviewed-by: Horia Geanta <horia.geanta@nxp.com> Reviewed-by: Ye Li <ye.li@nxp.com> (cherry picked from commit 5d10d1cab052f8af4fd00640e09642aa0a596922)
Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff
include/fsl_sec.h
... | ... | @@ -13,8 +13,8 @@ |
13 | 13 | #include <asm/io.h> |
14 | 14 | |
15 | 15 | #ifdef CONFIG_SYS_FSL_SEC_LE |
16 | -#define sec_in32(a) in_le32((ulong *)(ulong)a) | |
17 | -#define sec_out32(a, v) out_le32((ulong *)(ulong)a, v) | |
16 | +#define sec_in32(a) in_le32((ulong *)(ulong)(a)) | |
17 | +#define sec_out32(a, v) out_le32((ulong *)(ulong)(a), v) | |
18 | 18 | #define sec_in16(a) in_le16(a) |
19 | 19 | #define sec_clrbits32 clrbits_le32 |
20 | 20 | #define sec_setbits32 setbits_le32 |