mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] ARM64: mmu: Fix alloc_pte() address calculation
@ 2023-12-01 15:10 Sascha Hauer
  2023-12-01 15:10 ` [PATCH 2/3] ARM64: mmu: panic when out of PTEs Sascha Hauer
  2023-12-01 15:10 ` [PATCH 3/3] ARM: Rockchip: dmc: print memory sizes in hex Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Sascha Hauer @ 2023-12-01 15:10 UTC (permalink / raw)
  To: Barebox List; +Cc: Alexander Shiyan

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@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




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-01 15:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-01 15:10 [PATCH 1/3] ARM64: mmu: Fix alloc_pte() address calculation Sascha Hauer
2023-12-01 15:10 ` [PATCH 2/3] ARM64: mmu: panic when out of PTEs Sascha Hauer
2023-12-01 15:10 ` [PATCH 3/3] ARM: Rockchip: dmc: print memory sizes in hex Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox