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

[Xen-changelog] [xen master] IOMMU: replace ASSERT()s checking for NULL



commit 7b2842a414204842b0fb5b2c95d457bc6071f994
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Nov 7 14:08:05 2016 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Nov 7 14:08:05 2016 +0100

    IOMMU: replace ASSERT()s checking for NULL
    
    Avoid NULL derefs on non-debug builds.
    
    Coverity ID: 1055650
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Release-acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 xen/drivers/passthrough/io.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c
index 66577b6..574d22a 100644
--- a/xen/drivers/passthrough/io.c
+++ b/xen/drivers/passthrough/io.c
@@ -165,7 +165,11 @@ static void pt_irq_time_out(void *data)
     spin_lock(&irq_map->dom->event_lock);
 
     dpci = domain_get_irq_dpci(irq_map->dom);
-    ASSERT(dpci);
+    if ( unlikely(!dpci) )
+    {
+        ASSERT_UNREACHABLE();
+        return;
+    }
     list_for_each_entry ( digl, &irq_map->digl_list, list )
     {
         unsigned int guest_gsi = hvm_pci_intx_gsi(digl->device, digl->intx);
@@ -793,7 +797,11 @@ void hvm_dpci_msi_eoi(struct domain *d, int vector)
 
 static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
 {
-    ASSERT(d->arch.hvm_domain.irq.dpci);
+    if ( unlikely(!d->arch.hvm_domain.irq.dpci) )
+    {
+        ASSERT_UNREACHABLE();
+        return;
+    }
 
     spin_lock(&d->event_lock);
     if ( test_and_clear_bool(pirq_dpci->masked) )
--
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®.