All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liam Ni <zhiguangni01@gmail.com>
To: alex.williamson@redhat.com, cohuck@redhat.com
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	zhiguangni01@gmail.com
Subject: [PATCH] vfio: check iommu_group_set_name() return value
Date: Sat, 25 Jun 2022 19:42:39 +0800	[thread overview]
Message-ID: <20220625114239.9301-1-zhiguangni01@gmail.com> (raw)

As iommu_group_set_name() can fail,we should check the return value.

Signed-off-by: Liam Ni <zhiguangni01@gmail.com>
---
 drivers/vfio/vfio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index 61e71c1154be..ca823eeac237 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/vfio.c
@@ -504,7 +504,9 @@ static struct vfio_group *vfio_noiommu_group_alloc(struct device *dev,
 	if (IS_ERR(iommu_group))
 		return ERR_CAST(iommu_group);
 
-	iommu_group_set_name(iommu_group, "vfio-noiommu");
+	ret = iommu_group_set_name(iommu_group, "vfio-noiommu");
+	if (ret)
+		goto out_put_group;
 	ret = iommu_group_add_device(iommu_group, dev);
 	if (ret)
 		goto out_put_group;
-- 
2.25.1


             reply	other threads:[~2022-06-25 11:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-25 11:42 Liam Ni [this message]
2022-06-29  6:21 ` [PATCH] vfio: check iommu_group_set_name() return value Tian, Kevin
2022-06-29 17:54 ` Jason Gunthorpe
2022-06-30 19:51 ` Alex Williamson

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=20220625114239.9301-1-zhiguangni01@gmail.com \
    --to=zhiguangni01@gmail.com \
    --cc=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.