[PATCH 2/3] ARM64: mmu: panic when out of PTEs

Sascha Hauer s.hauer at pengutronix.de
Fri Dec 1 07:10:43 PST 2023


When running out of PTEs panic with an appropriate message instead of
continuing with NULL pointers.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/cpu/mmu_64.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/cpu/mmu_64.c b/arch/arm/cpu/mmu_64.c
index d62527809e..12c4dc90b3 100644
--- a/arch/arm/cpu/mmu_64.c
+++ b/arch/arm/cpu/mmu_64.c
@@ -99,6 +99,9 @@ static void split_block(uint64_t *pte, int level)
 	levelshift = level2shift(level + 1);
 
 	new_table = alloc_pte();
+	if (!new_table)
+		panic("Unable to allocate PTE\n");
+
 
 	for (i = 0; i < MAX_PTE_ENTRIES; i++) {
 		new_table[i] = old_pte | (i << levelshift);
-- 
2.39.2




More information about the barebox mailing list