Re: [PATCH 1/2] KVM: x86/xen: Remove redundant NULL check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Channeling Jim, s/redundant/superfluous.  Redundant would imply there's a !NULL
check in close proximity.

On Fri, Sep 09, 2022, Metin Kaya wrote:
> 'kvm' cannot be NULL if we are at that point.

Please make the changelog a standalone thing, i.e. don't rely on the shortlog to
provide context.  Some subsystems prefer making the changelog a continuation of
the shortlog, but IMO it makes life unnecessarily painful for reviewers and
archaeologists, e.g. I don't even see the subject/shortlog right now.

Please elaborate on what guarantees that this in the changelog.  It's trivial to
see from the code, but the fact that it's trivial to document is all the more
reason to provide a one-liner.

E.g.

  Remove a superfluous check that @kvm is non-NULL in
  kvm_xen_eventfd_deassign(), the pointer has already been dereferenced
  multiple times before the check, and the sole caller unconditionally
  passes in a valid pointer.

> This bug was discovered and resolved using Coverity Static Analysis
> Security Testing (SAST) by Synopsys, Inc.
> 
> Fixes: 2fd6df2f2b47 ("KVM: x86/xen: intercept EVTCHNOP_send from
> guests")

Don't wrap fixes tags.

> Signed-off-by: Metin Kaya <metikaya@xxxxxxxxxxxx>
> ---
>  arch/x86/kvm/xen.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c
> index 280cb5dc7341..f2e09481f633 100644
> --- a/arch/x86/kvm/xen.c
> +++ b/arch/x86/kvm/xen.c
> @@ -1734,8 +1734,7 @@ static int kvm_xen_eventfd_deassign(struct kvm *kvm, u32 port)
>  	if (!evtchnfd)
>  		return -ENOENT;
>  
> -	if (kvm)
> -		synchronize_srcu(&kvm->srcu);
> +	synchronize_srcu(&kvm->srcu);
>  	if (!evtchnfd->deliver.port.port)
>  		eventfd_ctx_put(evtchnfd->deliver.eventfd.ctx);
>  	kfree(evtchnfd);
> -- 
> 2.37.1
> 



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux