kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux-next] KVM: s390: pci: fix comparing pointer to 0
@ 2022-09-18 14:36 cgel.zte
  2022-09-19  6:34 ` Christian Borntraeger
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2022-09-18 14:36 UTC (permalink / raw)
  To: mjrosato
  Cc: farman, borntraeger, frankja, imbrenda, david, hca, gor,
	agordeev, svens, linux-s390, kvm, linux-kernel, Xu Panda,
	Zeal Robot

From: Xu Panda <xu.panda@zte.com.cn>

Comparing pointer whith NULL instead of comparing pointer to 0.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Xu Panda <xu.panda@zte.com.cn>
---
 arch/s390/kvm/pci.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/s390/kvm/pci.h b/arch/s390/kvm/pci.h
index 3a3606c3a0fe..aadafa2e03d1 100644
--- a/arch/s390/kvm/pci.h
+++ b/arch/s390/kvm/pci.h
@@ -46,8 +46,8 @@ extern struct zpci_aift *aift;
 static inline struct kvm *kvm_s390_pci_si_to_kvm(struct zpci_aift *aift,
                                                 unsigned long si)
 {
-       if (!IS_ENABLED(CONFIG_VFIO_PCI_ZDEV_KVM) || aift->kzdev == 0 ||
-           aift->kzdev[si] == 0)
+       if (!IS_ENABLED(CONFIG_VFIO_PCI_ZDEV_KVM) || aift->kzdev == NULL ||
+           aift->kzdev[si] == NULL)
                return 0;
        return aift->kzdev[si]->kvm;
 };
-- 
2.15.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH linux-next] KVM: s390: pci: fix comparing pointer to 0
  2022-09-18 14:36 [PATCH linux-next] KVM: s390: pci: fix comparing pointer to 0 cgel.zte
@ 2022-09-19  6:34 ` Christian Borntraeger
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Borntraeger @ 2022-09-19  6:34 UTC (permalink / raw)
  To: cgel.zte, mjrosato
  Cc: farman, frankja, imbrenda, david, hca, gor, agordeev, svens,
	linux-s390, kvm, linux-kernel, Xu Panda, Zeal Robot

Am 18.09.22 um 16:36 schrieb cgel.zte@gmail.com:
> From: Xu Panda <xu.panda@zte.com.cn>
> 
> Comparing pointer whith NULL instead of comparing pointer to 0.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Xu Panda <xu.panda@zte.com.cn>

Thanks but there is already a fix queued (https://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git/commit/?h=next&id=3ed2607b18cce86efed3a3c76fce89dc11184f62)
and your fix would still trigger checkpatch --strict warning.
> ---
>   arch/s390/kvm/pci.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/s390/kvm/pci.h b/arch/s390/kvm/pci.h
> index 3a3606c3a0fe..aadafa2e03d1 100644
> --- a/arch/s390/kvm/pci.h
> +++ b/arch/s390/kvm/pci.h
> @@ -46,8 +46,8 @@ extern struct zpci_aift *aift;
>   static inline struct kvm *kvm_s390_pci_si_to_kvm(struct zpci_aift *aift,
>                                                   unsigned long si)
>   {
> -       if (!IS_ENABLED(CONFIG_VFIO_PCI_ZDEV_KVM) || aift->kzdev == 0 ||
> -           aift->kzdev[si] == 0)
> +       if (!IS_ENABLED(CONFIG_VFIO_PCI_ZDEV_KVM) || aift->kzdev == NULL ||
> +           aift->kzdev[si] == NULL)
>                  return 0;
>          return aift->kzdev[si]->kvm;
>   };

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-19  6:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-18 14:36 [PATCH linux-next] KVM: s390: pci: fix comparing pointer to 0 cgel.zte
2022-09-19  6:34 ` Christian Borntraeger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).