Skip to contentSkip to conversation

ACPI: fix return value of XEN_PM_PDC platform op

PATCH In review Jan Beulich 2 participants 2 messages Nov 28, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: fix return value of XEN_PM_PDC platform op

Should return -EFAULT when copying to guest memory fails.

Once touching this code, also switch to using the more relaxed copy function (copying from the same guest memory already validated the virtual address range).

xen/drivers/acpi/pmstat.c +2 -2
@@ -521,8 +521,8 @@ int acpi_set_pdc_bits(u32 acpi_id, XEN_G
                     ACPI_PDC_SMP_C1PT) & ~mask;
         ret = arch_acpi_set_pdc_bits(acpi_id, bits, mask);
     }
-    if ( !ret )
-        ret = copy_to_guest_offset(pdc, 2, bits + 2, 1);
+    if ( !ret && __copy_to_guest_offset(pdc, 2, bits + 2, 1) )
+        ret = -EFAULT;
 
     return ret;
 }

ACPI: fix return value of XEN_PM_PDC platform op

Should return -EFAULT when copying to guest memory fails.

Once touching this code, also switch to using the more relaxed copy function (copying from the same guest memory already validated the virtual address range).

xen/drivers/acpi/pmstat.c +2 -2
@@ -521,8 +521,8 @@ int acpi_set_pdc_bits(u32 acpi_id, XEN_G
                     ACPI_PDC_SMP_C1PT) & ~mask;
         ret = arch_acpi_set_pdc_bits(acpi_id, bits, mask);
     }
-    if ( !ret )
-        ret = copy_to_guest_offset(pdc, 2, bits + 2, 1);
+    if ( !ret && __copy_to_guest_offset(pdc, 2, bits + 2, 1) )
+        ret = -EFAULT;
 
     return ret;
 }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Jan Beulich

Should return -EFAULT when copying to guest memory fails.

Once touching this code, also switch to using the more relaxed copy function (copying from the same guest memory already validated the virtual address range).

Quoted 20 lines
xen/drivers/acpi/pmstat.c +2 -2
@@ -521,8 +521,8 @@ int acpi_set_pdc_bits(u32 acpi_id, XEN_G
                     ACPI_PDC_SMP_C1PT) & ~mask;
         ret = arch_acpi_set_pdc_bits(acpi_id, bits, mask);
     }
-    if ( !ret )
-        ret = copy_to_guest_offset(pdc, 2, bits + 2, 1);
+    if ( !ret && __copy_to_guest_offset(pdc, 2, bits + 2, 1) )
+        ret = -EFAULT;
 
     return ret;
 }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel