From: Marc-André Lureau Date: Mon, 6 Jul 2026 08:54:21 +0000 (+0400) Subject: i386/tdx: fix uninitialized variable warning in tdx_check_features X-Git-Tag: v11.1.0-rc1~11^2~14 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=40cdadfefda3b930a64e5db0aae220bd00ce4ea7;p=thirdparty%2Fqemu.git i386/tdx: fix uninitialized variable warning in tdx_check_features tdx_fetch_cpuid() only sets the output ret parameter on the error path. GCC cannot prove that r is always initialized before use in the caller, triggering -Werror=maybe-uninitialized. Initialize r to -1 to silence the warning. Fixes: 228e40f33048 ("i386/tdx: Fetch and validate CPUID of TD guest") Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Marc-Andre Lureau --- diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c index c9c3b05d5f..8294dbde3a 100644 --- a/target/i386/kvm/tdx.c +++ b/target/i386/kvm/tdx.c @@ -887,7 +887,7 @@ static int tdx_check_features(X86ConfidentialGuest *cg, CPUState *cs) FeatureWordInfo *wi; FeatureWord w; bool mismatch = false; - int r; + int r = -1; fetch_cpuid = tdx_fetch_cpuid(cs, &r); if (!fetch_cpuid) {