acpi: check if mapping is valid before reading / writing
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 <[email protected]>
---
Cc: Jan Beulich <[email protected]>
--- xen/drivers/acpi/osl.c | 6 ++++++ 1 file changed, 6 insertions(+)
xen/drivers/acpi/osl.c +6 -0
@@ -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);
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 01.03.17 at 12:07, <[email protected]> wrote:
If
acpi_map_os_memoryhas failed, return early withAE_ERROR.Coverity-ID: 1401601
Coverity-ID: 1401602Signed-off-by Wei Liu <[email protected]>
Reviewed-by Jan Beulich <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel