Skip to contentSkip to conversation

x86/xen: Fix xen_e820_swap_entry_with_ram()

PATCH In review Juergen Gross 2 participants 2 messages May 5

Subsystems (2)
lore
Share & tools
lore

Juergen Gross

author maintainer
#0 lore raw

PATCH 1/1 x86/xen: Fix xen_e820_swap_entry_with_ram()

When swapping a not page-aligned E820 map entry with RAM, the start address of the modified entry is calculated wrong (the offset into the page is subtracted instead of being added to the page address).

Fixes be35d91c8880 ("xen: tolerate ACPI NVS memory overlapping with Xen allocated memory")
---
 arch/x86/xen/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/xen/setup.c +1 -1
index bb95a05259b8..41251d4cf953 100644
@@ -655,7 +655,7 @@ static void __init xen_e820_swap_entry_with_ram(struct e820_entry *swap_entry)
 			/* Fill new entry (keep size and page offset). */
 			entry->type = swap_entry->type;
 			entry->addr = entry_end - swap_size +
-				      swap_addr - swap_entry->addr;
+				      swap_entry->addr - swap_addr;
 			entry->size = swap_entry->size;
 
 			/* Convert old entry to RAM, align to pages. */
Signature · 1 line
2.54.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Juergen Gross

When swapping a not page-aligned E820 map entry with RAM, the start address of the modified entry is calculated wrong (the offset into the page is subtracted instead of being added to the page address).

Fixes be35d91c8880 ("xen: tolerate ACPI NVS memory overlapping with Xen allocated memory")