From 9ba7bada0890671654f534715c134d0259ca55c3 Mon Sep 17 00:00:00 2001 From: Zebreus Date: Mon, 13 Nov 2023 21:06:18 +0100 Subject: [PATCH] arch/arm64: Avoid GCC warning about out of bounds array access With the update to GCC 13 a new warning about subtracting numbers from arrays appears. src/arch/arm64/armv8/mmu.c:296:9: error: array subscript -1 is outside array bounds of 'u8[]' {aka 'unsigned char[]'} [-Werror=array-bounds=] Change-Id: I4757ca2e7ad3f969d7416041ea40c3e9866cdf49 Signed-off-by: Zebreus Reviewed-on: https://review.coreboot.org/c/coreboot/+/79014 Reviewed-by: Felix Singer Tested-by: build bot (Jenkins) --- src/arch/arm64/armv8/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arch/arm64/armv8/mmu.c b/src/arch/arm64/armv8/mmu.c index 61ca49ff2c..3cedbcf58f 100644 --- a/src/arch/arm64/armv8/mmu.c +++ b/src/arch/arm64/armv8/mmu.c @@ -293,7 +293,7 @@ void mmu_restore_context(const struct mmu_context *mmu_context) void mmu_enable(void) { assert_correct_ttb_mapping(_ttb); - assert_correct_ttb_mapping(_ettb - 1); + assert_correct_ttb_mapping((void *)((uintptr_t)_ettb - 1)); uint32_t sctlr = raw_read_sctlr_el3(); sctlr |= SCTLR_C | SCTLR_M | SCTLR_I;