]> xenbits.xensource.com Git - xen.git/commitdiff
x86/setup: correct off-by-1 in module mapping
authorJan Beulich <jbeulich@suse.com>
Thu, 20 Mar 2025 07:51:55 +0000 (08:51 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 20 Mar 2025 07:51:55 +0000 (08:51 +0100)
If a module's length is an exact multiple of PAGE_SIZE, the 2nd argument
passed to set_pdx_range() would be one larger than intended. Use
PFN_{UP,DOWN}() there instead.

Fixes: cd7cc5320bb2 ("x86/boot: add start and size fields to struct boot_module")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
xen/arch/x86/setup.c

index bde5d75ea6abd546d8cc40a3a02a3e9285bd5677..715719213de7c19fb5fe4522beb43c8ecf4856c7 100644 (file)
@@ -1730,7 +1730,7 @@ void asmlinkage __init noreturn __start_xen(void)
     {
         unsigned long s = bi->mods[i].start, l = bi->mods[i].size;
 
-        set_pdx_range(paddr_to_pfn(s), paddr_to_pfn(s + l) + 1);
+        set_pdx_range(PFN_DOWN(s), PFN_UP(s + l));
         map_pages_to_xen((unsigned long)maddr_to_virt(s), maddr_to_mfn(s),
                          PFN_UP(l), PAGE_HYPERVISOR);
     }