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

[Xen-devel] [PATCH RFC] x86/irq: Fix maybe uninitalised issue in map_domain_pirq()



When compiling at -O3, GCC 7.2 reports:

  irq.c: In function 'map_domain_pirq':
  irq.c:1271:20: error: 'info' may be used uninitialized in this function 
[-Werror=maybe-uninitialized]
       pirq->arch.irq = irq;
       ~~~~~~~~~~~~~~~^~~~~
  irq.c:1917:18: note: 'info' was declared here
       struct pirq *info;
                    ^~~~

This is a real issue, and is caused by different error style confusion in
prepare_domain_irq_pirq().  A positive return value from radix_tree_insert()
will take the early error path, and report success to map_domain_pirq().

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>

I don't think this is the right change to make, but initialising note to NULL
is definitely the wrong thing to do.  Thoughts?
---
 xen/arch/x86/irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index 87ef2e8..b613733 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -1249,7 +1249,7 @@ static int prepare_domain_irq_pirq(struct domain *d, int 
irq, int pirq,
                                 radix_tree_int_to_ptr(0));
     struct pirq *info;
 
-    if ( err && err != -EEXIST )
+    if ( err < 0 && err != -EEXIST )
         return err;
     info = pirq_get_info(d, pirq);
     if ( !info )
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.