Commit fac7f7 changed the value of ptr so that it points to the right memory
area, taking the page offset into account, but failed to remove this when
doing the unmap, which caused the region to not be unmapped. Fix this by not
modifying ptr and instead adding the page offset directly in the memcpy
call.
Coverity-ID:
1394285
Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-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>
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);
+ memcpy((uint8_t *)ptr +
+ (dom->acpi_modules[i].guest_addr_out & ~XC_PAGE_MASK),
+ dom->acpi_modules[i].data, dom->acpi_modules[i].length);
munmap(ptr, XC_PAGE_SIZE * num_pages);
free(extents);