From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Dave Hansen <dave.hansen@linux.intel.com>, linux-kernel@vger.kernel.org
Cc: Borislav Petkov <bp@alien8.de>, "H. Peter Anvin" <hpa@zytor.com>,
Ingo Molnar <mingo@redhat.com>,
"Kirill A. Shutemov" <kas@kernel.org>,
kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
Rick Edgecombe <rick.p.edgecombe@intel.com>,
Sean Christopherson <seanjc@google.com>,
Thomas Gleixner <tglx@linutronix.de>,
x86@kernel.org
Subject: Re: [v2][PATCH 2/2] x86/virt/tdx: Fix sparse warnings from using 0 for NULL
Date: Tue, 4 Nov 2025 17:56:23 +0800 [thread overview]
Message-ID: <cea597f3-3a59-4775-b416-f95360d52b0f@intel.com> (raw)
In-Reply-To: <20251103234439.DC8227E4@davehans-spike.ostc.intel.com>
On 11/4/2025 7:44 AM, Dave Hansen wrote:
>
> From: Dave Hansen <dave.hansen@linux.intel.com>
>
> 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: a50f673f25e0 ("KVM: TDX: Do TDX specific vcpu initialization")
> Fixes: 8d032b683c29 ("KVM: TDX: create/destroy VM structure")
> Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@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
> ---
>
> b/arch/x86/kvm/vmx/tdx.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff -puN arch/x86/kvm/vmx/tdx.c~tdx-sparse-fix-1 arch/x86/kvm/vmx/tdx.c
> --- a/arch/x86/kvm/vmx/tdx.c~tdx-sparse-fix-1 2025-11-03 15:11:28.177643833 -0800
> +++ b/arch/x86/kvm/vmx/tdx.c 2025-11-03 15:11:28.185644508 -0800
> @@ -856,7 +856,7 @@ void tdx_vcpu_free(struct kvm_vcpu *vcpu
> }
> if (tdx->vp.tdvpr_page) {
> tdx_reclaim_control_page(tdx->vp.tdvpr_page);
> - tdx->vp.tdvpr_page = 0;
> + tdx->vp.tdvpr_page = NULL;
> tdx->vp.tdvpr_pa = 0;
> }
>
> @@ -2642,7 +2642,7 @@ free_tdcs:
> free_tdr:
> if (tdr_page)
> __free_page(tdr_page);
> - kvm_tdx->td.tdr_page = 0;
> + kvm_tdx->td.tdr_page = NULL;
>
> free_hkid:
> tdx_hkid_free(kvm_tdx);
> @@ -3016,7 +3016,7 @@ free_tdcx:
> free_tdvpr:
> if (tdx->vp.tdvpr_page)
> __free_page(tdx->vp.tdvpr_page);
> - tdx->vp.tdvpr_page = 0;
> + tdx->vp.tdvpr_page = NULL;
> tdx->vp.tdvpr_pa = 0;
>
> return ret;
> _
next prev parent reply other threads:[~2025-11-04 9:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-03 23:44 [v2][PATCH 0/2] x86/virt/tdx: Minor sparse fixups Dave Hansen
2025-11-03 23:44 ` [v2][PATCH 1/2] x86/virt/tdx: Remove __user annotation from kernel pointer Dave Hansen
2025-11-04 9:23 ` Kiryl Shutsemau
2025-11-04 9:55 ` Xiaoyao Li
2025-11-04 16:31 ` Sean Christopherson
2025-11-03 23:44 ` [v2][PATCH 2/2] x86/virt/tdx: Fix sparse warnings from using 0 for NULL Dave Hansen
2025-11-04 9:24 ` Kiryl Shutsemau
2025-11-04 9:56 ` Xiaoyao Li [this message]
2025-11-18 23:27 ` [v2][PATCH 0/2] x86/virt/tdx: Minor sparse fixups Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cea597f3-3a59-4775-b416-f95360d52b0f@intel.com \
--to=xiaoyao.li@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kas@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rick.p.edgecombe@intel.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®