passthrough/amd: avoid reading an uninitialized variable
authorTim Deegan <tim@xen.org>
Fri, 24 Apr 2015 10:04:57 +0000 (12:04 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 24 Apr 2015 10:04:57 +0000 (12:04 +0200)
update_intremap_entry_from_msi() doesn't write to its data pointer on
some error paths, so we copying that variable into the msg would count
as undefined behaviour.

Signed-off-by: Tim Deegan <tim@xen.org>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
xen/drivers/passthrough/amd/iommu_intr.c

index c1b76fb9d036a1d75c9bff300700a15d98818636..439ba05f2ac82a7d8b1e516be48f6970fb8d5510 100644 (file)
@@ -529,10 +529,12 @@ int amd_iommu_msi_msg_update_ire(
     } while ( PCI_SLOT(bdf) == PCI_SLOT(pdev->devfn) );
 
     if ( !rc )
+    {
         for ( i = 1; i < nr; ++i )
             msi_desc[i].remap_index = msi_desc->remap_index + i;
+        msg->data = data;
+    }
 
-    msg->data = data;
     return rc;
 }