File 553a1549-passthrough-amd-avoid-reading-an-uninitialized-variable.patch of Package xen.950
# Commit a8ccf2d9f6f291f8fc6003e3d8bc7275ac1cc69f
# Date 2015-04-24 12:04:57 +0200
# Author Tim Deegan <tim@xen.org>
# Committer Jan Beulich <jbeulich@suse.com>
passthrough/amd: avoid reading an uninitialized variable
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>
--- a/xen/drivers/passthrough/amd/iommu_intr.c
+++ b/xen/drivers/passthrough/amd/iommu_intr.c
@@ -531,10 +531,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;
}