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

[xen stable-4.20] xen: x86: irq: initialize irq desc in create_irq()



commit 1a8df8282cca556b4355d2cd7b87d598bdcf2a02
Author:     Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
AuthorDate: Tue Apr 29 11:41:38 2025 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Apr 29 11:41:38 2025 +0200

    xen: x86: irq: initialize irq desc in create_irq()
    
    While building xen with GCC 14.2.1 with "-fcondition-coverage" option
    or with "-Og", the compiler produces a false positive warning:
    
      arch/x86/irq.c: In function â??create_irqâ??:
      arch/x86/irq.c:281:11: error: â??descâ?? may be used uninitialized 
[-Werror=maybe-uninitialized]
        281 |     ret = init_one_irq_desc(desc);
            |           ^~~~~~~~~~~~~~~~~~~~~~~
      arch/x86/irq.c:269:22: note: â??descâ?? was declared here
        269 |     struct irq_desc *desc;
            |                      ^~~~
      cc1: all warnings being treated as errors
      make[2]: *** [Rules.mk:252: arch/x86/irq.o] Error 1
    
    While we have signed/unsigned comparison both in "for" loop and in
    "if" statement, this still can't lead to use of uninitialized "desc",
    as either loop will be executed at least once, or the function will
    return early. So this is a clearly false positive warning due to a
    bug [1] in GCC.
    
    Initialize "desc" with NULL to make GCC happy.
    
    [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119665
    
    Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    master commit: 7a4484d90b3003171f1700e424ad45b931200ba6
    master date: 2025-04-08 09:40:39 +0200
---
 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 ff3ac832f4..3a09ed6346 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -265,7 +265,7 @@ void __init clear_irq_vector(int irq)
 int create_irq(nodeid_t node, bool grant_access)
 {
     int irq, ret;
-    struct irq_desc *desc;
+    struct irq_desc *desc = NULL ; /* gcc14 -Og or -fcondition-coverage */
 
     for (irq = nr_irqs_gsi; irq < nr_irqs; irq++)
     {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20



 


Rackspace

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