public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH] x86/eventinj: Fix flush_cache() macro for the newer versions of Clang
@ 2026-04-13  9:49 Thomas Huth
  0 siblings, 0 replies; only message in thread
From: Thomas Huth @ 2026-04-13  9:49 UTC (permalink / raw)
  To: Paolo Bonzini, kvm

From: Thomas Huth <thuth@redhat.com>

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.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 x86/eventinj.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/x86/eventinj.c b/x86/eventinj.c
index e72efa16..7f68bdb8 100644
--- a/x86/eventinj.c
+++ b/x86/eventinj.c
@@ -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)
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-13  9:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-13  9:49 [kvm-unit-tests PATCH] x86/eventinj: Fix flush_cache() macro for the newer versions of Clang Thomas Huth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox