libxc: properly account for the page offset when copying ACPI data

Or else ACPI data is always copied at the start of the page pointed by
guest_addr_out, ignoring the page offset.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-and-Tested-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
This commit is contained in:
Roger Pau Monne authored and Wei Liu committed 2016-11-08 01:55:27 +00:00
1 parent 712db0f301
commit fac7f77b69
1 file changed
+6 -2
+6 -2
View File
@@ -1090,8 +1090,9 @@ static int xc_dom_load_acpi(struct xc_dom_image *dom)
dom->acpi_modules[i].length,
dom->acpi_modules[i].guest_addr_out);
num_pages = (dom->acpi_modules[i].length + (XC_PAGE_SIZE - 1)) >>
XC_PAGE_SHIFT;
num_pages = (dom->acpi_modules[i].length +
(dom->acpi_modules[i].guest_addr_out & ~XC_PAGE_MASK) +
(XC_PAGE_SIZE - 1)) >> XC_PAGE_SHIFT;
extents = malloc(num_pages * sizeof(*extents));
if ( !extents )
{
@@ -1118,6 +1119,9 @@ static int xc_dom_load_acpi(struct xc_dom_image *dom)
goto err;
}
ptr = (uint8_t *)ptr +
(dom->acpi_modules[i].guest_addr_out & ~XC_PAGE_MASK);
memcpy(ptr, dom->acpi_modules[i].data, dom->acpi_modules[i].length);
munmap(ptr, XC_PAGE_SIZE * num_pages);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.