All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] passthrough/amd: avoid reading an uninitialized variable.
@ 2015-04-16 16:44 Tim Deegan
  2015-04-16 17:19 ` Andrew Cooper
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Tim Deegan @ 2015-04-16 16:44 UTC (permalink / raw)
  To: xen-devel; +Cc: Aravind Gopalakrishnan, Suravee Suthikulpanit

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>
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Cc: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
---
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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-04-23 22:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-16 16:44 [PATCH] passthrough/amd: avoid reading an uninitialized variable Tim Deegan
2015-04-16 17:19 ` Andrew Cooper
2015-04-17  8:01   ` Jan Beulich
2015-04-16 18:49 ` Konrad Rzeszutek Wilk
2015-04-23  9:25 ` Tim Deegan
2015-04-23 22:16   ` Suthikulpanit, Suravee

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.