Skip to contentSkip to conversation

x86/eventinj: Fix flush_cache() macro for the newer versions of Clang

PATCH New Thomas Huth 1 participant 1 message Apr 13 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/eventinj: Fix flush_cache() macro for the newer versions of Clang

From: Thomas Huth <[email protected]>

Clang v21.1.8 from Fedora 43 complains:

x86/eventinj.c:347:2: error: variable '__l' is uninitialized when passed
as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]

   347 |         flush_stack();
       |         ^~~~~~~~~~~~~
 x86/eventinj.c:39:33: note: expanded from macro 'flush_stack'
    39 |                 flush_phys_addr(virt_to_phys(&__l));
       |                                               ^~~

Initialize the temporary variable to 0 to avoid the warning.

---
 x86/eventinj.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
x86/eventinj.c +1 -1
index e72efa16..7f68bdb8 100644
@@ -35,7 +35,7 @@ static void apic_self_nmi(void)
 	} while (0)
 
 #define flush_stack() do {						\
-		int __l;						\
+		int __l = 0;						\
 		flush_phys_addr(virt_to_phys(&__l));			\
 	} while (0)
 
Signature · 1 line
2.53.0