mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next] vfio/pds: fix return value in pds_vfio_get_lm_file()
@ 2023-08-19  2:37 Yang Yingliang
  2023-08-19 18:15 ` Brett Creeley
  2023-08-21 15:08 ` Alex Williamson
  0 siblings, 2 replies; 3+ messages in thread
From: Yang Yingliang @ 2023-08-19  2:37 UTC (permalink / raw)
  To: kvm, linux-kernel
  Cc: brett.creeley, jgg, yishaih, shameerali.kolothum.thodi,
	kevin.tian, alex.williamson, horms, shannon.nelson,
	yangyingliang

anon_inode_getfile() never returns NULL pointer, it will return
ERR_PTR() when it fails, so replace the check with IS_ERR().

Fixes: bb500dbe2ac6 ("vfio/pds: Add VFIO live migration support")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/vfio/pci/pds/lm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vfio/pci/pds/lm.c b/drivers/vfio/pci/pds/lm.c
index aec75574cab3..79fe2e66bb49 100644
--- a/drivers/vfio/pci/pds/lm.c
+++ b/drivers/vfio/pci/pds/lm.c
@@ -31,7 +31,7 @@ pds_vfio_get_lm_file(const struct file_operations *fops, int flags, u64 size)
 	/* Create file */
 	lm_file->filep =
 		anon_inode_getfile("pds_vfio_lm", fops, lm_file, flags);
-	if (!lm_file->filep)
+	if (IS_ERR(lm_file->filep))
 		goto out_free_file;
 
 	stream_open(lm_file->filep->f_inode, lm_file->filep);
-- 
2.25.1


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

* Re: [PATCH -next] vfio/pds: fix return value in pds_vfio_get_lm_file()
  2023-08-19  2:37 [PATCH -next] vfio/pds: fix return value in pds_vfio_get_lm_file() Yang Yingliang
@ 2023-08-19 18:15 ` Brett Creeley
  2023-08-21 15:08 ` Alex Williamson
  1 sibling, 0 replies; 3+ messages in thread
From: Brett Creeley @ 2023-08-19 18:15 UTC (permalink / raw)
  To: Yang Yingliang, kvm, linux-kernel
  Cc: brett.creeley, jgg, yishaih, shameerali.kolothum.thodi,
	kevin.tian, alex.williamson, horms, shannon.nelson

On 8/18/2023 7:37 PM, Yang Yingliang wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> 
> 
> anon_inode_getfile() never returns NULL pointer, it will return
> ERR_PTR() when it fails, so replace the check with IS_ERR().
> 
> Fixes: bb500dbe2ac6 ("vfio/pds: Add VFIO live migration support")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>   drivers/vfio/pci/pds/lm.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/vfio/pci/pds/lm.c b/drivers/vfio/pci/pds/lm.c
> index aec75574cab3..79fe2e66bb49 100644
> --- a/drivers/vfio/pci/pds/lm.c
> +++ b/drivers/vfio/pci/pds/lm.c
> @@ -31,7 +31,7 @@ pds_vfio_get_lm_file(const struct file_operations *fops, int flags, u64 size)
>          /* Create file */
>          lm_file->filep =
>                  anon_inode_getfile("pds_vfio_lm", fops, lm_file, flags);
> -       if (!lm_file->filep)
> +       if (IS_ERR(lm_file->filep))
>                  goto out_free_file;

LGTM! Thanks for fixing this.

Reviewed-by: Brett Creeley <brett.creeley@amd.com>

> 
>          stream_open(lm_file->filep->f_inode, lm_file->filep);
> --
> 2.25.1
> 

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

* Re: [PATCH -next] vfio/pds: fix return value in pds_vfio_get_lm_file()
  2023-08-19  2:37 [PATCH -next] vfio/pds: fix return value in pds_vfio_get_lm_file() Yang Yingliang
  2023-08-19 18:15 ` Brett Creeley
@ 2023-08-21 15:08 ` Alex Williamson
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Williamson @ 2023-08-21 15:08 UTC (permalink / raw)
  To: Yang Yingliang
  Cc: kvm, linux-kernel, brett.creeley, jgg, yishaih,
	shameerali.kolothum.thodi, kevin.tian, horms, shannon.nelson

On Sat, 19 Aug 2023 10:37:16 +0800
Yang Yingliang <yangyingliang@huawei.com> wrote:

> anon_inode_getfile() never returns NULL pointer, it will return
> ERR_PTR() when it fails, so replace the check with IS_ERR().
> 
> Fixes: bb500dbe2ac6 ("vfio/pds: Add VFIO live migration support")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/vfio/pci/pds/lm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/vfio/pci/pds/lm.c b/drivers/vfio/pci/pds/lm.c
> index aec75574cab3..79fe2e66bb49 100644
> --- a/drivers/vfio/pci/pds/lm.c
> +++ b/drivers/vfio/pci/pds/lm.c
> @@ -31,7 +31,7 @@ pds_vfio_get_lm_file(const struct file_operations *fops, int flags, u64 size)
>  	/* Create file */
>  	lm_file->filep =
>  		anon_inode_getfile("pds_vfio_lm", fops, lm_file, flags);
> -	if (!lm_file->filep)
> +	if (IS_ERR(lm_file->filep))
>  		goto out_free_file;
>  
>  	stream_open(lm_file->filep->f_inode, lm_file->filep);

Applied to vfio next branch for v6.6.  Thanks,

Alex


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

end of thread, other threads:[~2023-08-21 15:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-19  2:37 [PATCH -next] vfio/pds: fix return value in pds_vfio_get_lm_file() Yang Yingliang
2023-08-19 18:15 ` Brett Creeley
2023-08-21 15:08 ` Alex Williamson

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®