[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 2/2] acpi: check if mapping is valid before reading / writing
If acpi_map_os_memory has failed, return early with AE_ERROR. Coverity-ID: 1401601 Coverity-ID: 1401602 Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- Cc: Jan Beulich <JBeulich@xxxxxxxx> --- xen/drivers/acpi/osl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xen/drivers/acpi/osl.c b/xen/drivers/acpi/osl.c index 94dbf0406f..9881db19da 100644 --- a/xen/drivers/acpi/osl.c +++ b/xen/drivers/acpi/osl.c @@ -155,6 +155,9 @@ acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width) u32 dummy; void __iomem *virt_addr = acpi_os_map_memory(phys_addr, width >> 3); + if (!virt_addr) + return AE_ERROR; + if (!value) value = &dummy; @@ -182,6 +185,9 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width) { void __iomem *virt_addr = acpi_os_map_memory(phys_addr, width >> 3); + if (!virt_addr) + return AE_ERROR; + switch (width) { case 8: writeb(value, virt_addr); -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |