arm64: ptdump: Fix format output during pagetable parsing
Fix an issue where the output range printed to debugfs was no showing
out correctly. If the st->start_address was larger than the current
addr the delta variable calculated as delta = addr - st->start_address
used to display the size of the address range will overflow. This leads
to wrong printed values to debugfs when someone tries to read from the
host_stage2_kernel_page_tables.
Signed-off-by: Sebastian Ene <sebastianene@google.com>
diff --git a/arch/arm64/mm/ptdump.c b/arch/arm64/mm/ptdump.c
index e195a0a..6c6f978 100644
--- a/arch/arm64/mm/ptdump.c
+++ b/arch/arm64/mm/ptdump.c
@@ -397,6 +397,9 @@
const char *unit = units;
unsigned long delta;
+ if (st->start_address > addr)
+ return;
+
if (st->current_prot) {
note_prot_uxn(st, addr);
note_prot_wx(st, addr);