[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] acpi: check if mapping is valid before reading / writing



commit 34b05462d93f06f9a08caf98b7aed865f6b796bd
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Wed Mar 1 11:07:24 2017 +0000
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Thu Mar 2 08:32:30 2017 +0000

    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>
    Reviewed-by: 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 94dbf04..9881db1 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);
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.