]> xenbits.xensource.com Git - xen.git/commitdiff
x86/PVHv2: fix dereference of native RSDP table mapping
authorRoger Pau Monne <roger.pau@citrix.com>
Mon, 27 Feb 2017 12:14:38 +0000 (12:14 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 27 Feb 2017 16:44:07 +0000 (16:44 +0000)
Check that the RSDP is mapped before trying to access it.

Spotted-by: Coverity
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/domain_build.c

index d74296509a87c1969e6fc35a63d0b75c41d3bc7f..78ae741bc59161b7526ed223416a424c720b6b67 100644 (file)
@@ -2592,6 +2592,11 @@ static int __init pvh_setup_acpi(struct domain *d, paddr_t start_info)
 
     /* Craft a custom RSDP. */
     native_rsdp = acpi_os_map_memory(acpi_os_get_root_pointer(), sizeof(rsdp));
+    if ( !native_rsdp )
+    {
+        printk("Failed to map native RSDP\n");
+        return -ENOMEM;
+    }
     memcpy(rsdp.oem_id, native_rsdp->oem_id, sizeof(rsdp.oem_id));
     acpi_os_unmap_memory(native_rsdp, sizeof(rsdp));
     rsdp.xsdt_physical_address = xsdt_paddr;