]> Git Repo - linux.git/commitdiff
KVM: SVM: Fix uninitialized variable bug
authorDan Carpenter <[email protected]>
Wed, 12 Jun 2024 11:50:38 +0000 (14:50 +0300)
committerPaolo Bonzini <[email protected]>
Tue, 13 Aug 2024 10:05:10 +0000 (06:05 -0400)
If snp_lookup_rmpentry() fails then "assigned" is printed in the error
message but it was never initialized.  Initialize it to false.

Fixes: dee5a47cc7a4 ("KVM: SEV: Add KVM_SEV_SNP_LAUNCH_UPDATE command")
Signed-off-by: Dan Carpenter <[email protected]>
Message-ID: <20240612115040.2423290[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
arch/x86/kvm/svm/sev.c

index 532df12b43c5b7629dd5a616b7f0b921cba21ba8..393f450adbc36ac2a5962f5108241602867a21fe 100644 (file)
@@ -2276,7 +2276,7 @@ static int sev_gmem_post_populate(struct kvm *kvm, gfn_t gfn_start, kvm_pfn_t pf
 
        for (gfn = gfn_start, i = 0; gfn < gfn_start + npages; gfn++, i++) {
                struct sev_data_snp_launch_update fw_args = {0};
-               bool assigned;
+               bool assigned = false;
                int level;
 
                ret = snp_lookup_rmpentry((u64)pfn + i, &assigned, &level);
This page took 0.052465 seconds and 4 git commands to generate.