From: Tim Deegan Subject: [PATCH] passthrough/amd: avoid reading an uninitialized variable. Date: Thu, 16 Apr 2015 17:44:10 +0100 Message-ID: <1429202650-2608-1-git-send-email-tim@xen.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Aravind Gopalakrishnan , Suravee Suthikulpanit List-Id: xen-devel@lists.xenproject.org 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 Cc: Suravee Suthikulpanit Cc: Aravind Gopalakrishnan --- I'm not sure whether we ought to be writing some default value instead. Happy to respin if someone knowledgeable can advise. --- xen/drivers/passthrough/amd/iommu_intr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/drivers/passthrough/amd/iommu_intr.c b/xen/drivers/passthrough/amd/iommu_intr.c index c1b76fb..c097d52 100644 --- a/xen/drivers/passthrough/amd/iommu_intr.c +++ b/xen/drivers/passthrough/amd/iommu_intr.c @@ -529,10 +529,11 @@ 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; } -- 2.1.4