Skip to content

Commit 2737646

Browse files
hansendcsean-jc
authored andcommitted
KVM: TDX: Fix sparse warnings from using 0 for NULL
Stop using 0 for NULL. sparse moans: ... arch/x86/kvm/vmx/tdx.c:859:38: warning: Using plain integer as NULL pointer for several TDX pointer initializations. While I love a good ptr=0 now and then, it's good to have quiet sparse builds. Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Fixes: a50f673 ("KVM: TDX: Do TDX specific vcpu initialization") Fixes: 8d032b6 ("KVM: TDX: create/destroy VM structure") Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com> Cc: Xiaoyao Li <xiaoyao.li@intel.com> Cc: Sean Christopherson <seanjc@google.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: x86@kernel.org Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: "Kirill A. Shutemov" <kas@kernel.org> Cc: Rick Edgecombe <rick.p.edgecombe@intel.com> Cc: kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com> Acked-by: Kiryl Shutsemau <kas@kernel.org> Link: https://patch.msgid.link/20251103234439.DC8227E4@davehans-spike.ostc.intel.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 228add3 commit 2737646

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/x86/kvm/vmx/tdx.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ void tdx_vcpu_free(struct kvm_vcpu *vcpu)
903903
}
904904
if (tdx->vp.tdvpr_page) {
905905
tdx_reclaim_control_page(tdx->vp.tdvpr_page);
906-
tdx->vp.tdvpr_page = 0;
906+
tdx->vp.tdvpr_page = NULL;
907907
tdx->vp.tdvpr_pa = 0;
908908
}
909909

@@ -2581,7 +2581,7 @@ static int __tdx_td_init(struct kvm *kvm, struct td_params *td_params,
25812581
free_tdr:
25822582
if (tdr_page)
25832583
__free_page(tdr_page);
2584-
kvm_tdx->td.tdr_page = 0;
2584+
kvm_tdx->td.tdr_page = NULL;
25852585

25862586
free_hkid:
25872587
tdx_hkid_free(kvm_tdx);
@@ -3000,7 +3000,7 @@ static int tdx_td_vcpu_init(struct kvm_vcpu *vcpu, u64 vcpu_rcx)
30003000
free_tdvpr:
30013001
if (tdx->vp.tdvpr_page)
30023002
__free_page(tdx->vp.tdvpr_page);
3003-
tdx->vp.tdvpr_page = 0;
3003+
tdx->vp.tdvpr_page = NULL;
30043004
tdx->vp.tdvpr_pa = 0;
30053005

30063006
return ret;

0 commit comments

Comments
 (0)