[PATCH] x86/xen: Fix xen_e820_swap_entry_with_ram()

Juergen Gross posted 1 patch 3 weeks, 4 days ago
Failed in applying to current master (apply log)
There is a newer version of this series
arch/x86/xen/setup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] x86/xen: Fix xen_e820_swap_entry_with_ram()
Posted by Juergen Gross 3 weeks, 4 days ago
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")
Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/xen/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index bb95a05259b8..41251d4cf953 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -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. */
-- 
2.54.0
Re: [PATCH] x86/xen: Fix xen_e820_swap_entry_with_ram()
Posted by Jan Beulich 3 weeks, 4 days ago
On 05.05.2026 12:24, Juergen Gross wrote:
> 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")
> Reported-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>