[PATCH 1/3] ARM64: mmu: Fix alloc_pte() address calculation
Sascha Hauer
s.hauer at pengutronix.de
Fri Dec 1 07:10:42 PST 2023
get_ttb() returns an uint64_t * which means that with
get_ttb() + idx * GRANULE_SIZE
the distance between two PTEs is wrongly calculated as 0x8000 bytes
instead of 0x1000 bytes. With this we leave the space allocated for PTEs
quite fast and the available space check also doesn't work.
Fix this by explicitly casting to void *.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
arch/arm/cpu/mmu_64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/cpu/mmu_64.c b/arch/arm/cpu/mmu_64.c
index 716e717c72..d62527809e 100644
--- a/arch/arm/cpu/mmu_64.c
+++ b/arch/arm/cpu/mmu_64.c
@@ -45,7 +45,7 @@ static uint64_t *alloc_pte(void)
if (idx * GRANULE_SIZE >= ARM_EARLY_PAGETABLE_SIZE)
return NULL;
- return get_ttb() + idx * GRANULE_SIZE;
+ return (void *)get_ttb() + idx * GRANULE_SIZE;
}
#else
static uint64_t *alloc_pte(void)
--
2.39.2
More information about the barebox
mailing list