From: Kirti Wankhede <kwankhede@nvidia.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
Alex Williamson <alex.williamson@redhat.com>
Cc: kvm@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] vfio: vfio_group_get_from_dev() doesn't return error pointers
Date: Mon, 28 Nov 2016 12:29:52 +0000 [thread overview]
Message-ID: <8fff4459-6cd2-d270-ee8c-436c20b94bbb@nvidia.com> (raw)
In-Reply-To: <20161124110849.GF17225@mwanda>
On 11/24/2016 4:38 PM, Dan Carpenter wrote:
> These are all checking for IS_ERR() but vfio_group_get_from_dev()
> returns NULL pointers on error.
>
> Fixes: c086de818dd8 ("vfio iommu: Add blocking notifier to notify DMA_UNMAP")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
> index 0aac3ca..952e68c 100644
> --- a/drivers/vfio/vfio.c
> +++ b/drivers/vfio/vfio.c
> @@ -1933,8 +1933,8 @@ int vfio_pin_pages(struct device *dev, unsigned long *user_pfn, int npage,
> return -E2BIG;
>
> group = vfio_group_get_from_dev(dev);
> - if (IS_ERR(group))
> - return PTR_ERR(group);
> + if (!group)
> + return -EINVAL;
>
> ret = vfio_group_add_container_user(group);
> if (ret)
> @@ -1982,8 +1982,8 @@ int vfio_unpin_pages(struct device *dev, unsigned long *user_pfn, int npage)
> return -E2BIG;
>
> group = vfio_group_get_from_dev(dev);
> - if (IS_ERR(group))
> - return PTR_ERR(group);
> + if (!group)
> + return -EINVAL;
>
> ret = vfio_group_add_container_user(group);
> if (ret)
> @@ -2019,8 +2019,8 @@ int vfio_register_notifier(struct device *dev, struct notifier_block *nb)
> return -EINVAL;
>
> group = vfio_group_get_from_dev(dev);
> - if (IS_ERR(group))
> - return PTR_ERR(group);
> + if (!group)
> + return -EINVAL;
>
> ret = vfio_group_add_container_user(group);
> if (ret)
> @@ -2055,8 +2055,8 @@ int vfio_unregister_notifier(struct device *dev, struct notifier_block *nb)
> return -EINVAL;
>
> group = vfio_group_get_from_dev(dev);
> - if (IS_ERR(group))
> - return PTR_ERR(group);
> + if (!group)
> + return -EINVAL;
>
> ret = vfio_group_add_container_user(group);
> if (ret)
> --
This makes sense. Thanks for fixing this.
Reviewed by: Kirti Wankhede <kwankhede@nvidia.com>
prev parent reply other threads:[~2016-11-28 12:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-24 11:08 [patch] vfio: vfio_group_get_from_dev() doesn't return error pointers Dan Carpenter
2016-11-28 12:29 ` Kirti Wankhede [this message]
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=8fff4459-6cd2-d270-ee8c-436c20b94bbb@nvidia.com \
--to=kwankhede@nvidia.com \
--cc=alex.williamson@redhat.com \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kvm@vger.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