All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] vdpa: add the check for id_table in struct vdpa_mgmt_dev
@ 2022-04-25  6:27 Cindy Lu
  2022-04-25  8:59   ` Jason Wang
  0 siblings, 1 reply; 13+ messages in thread
From: Cindy Lu @ 2022-04-25  6:27 UTC (permalink / raw)
  To: mst, jasowang, lulu, virtualization, linux-kernel

To support the dynamic ids in vp_vdpa, we need to add the check for
id table. If the id table is NULL, will not set the device type

Signed-off-by: Cindy Lu <lulu@redhat.com>
---
 drivers/vdpa/vdpa.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
index 1ea525433a5c..09edd92cede0 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -492,10 +492,13 @@ static int vdpa_mgmtdev_fill(const struct vdpa_mgmt_dev *mdev, struct sk_buff *m
 	if (err)
 		goto msg_err;
 
-	while (mdev->id_table[i].device) {
-		if (mdev->id_table[i].device <= 63)
-			supported_classes |= BIT_ULL(mdev->id_table[i].device);
-		i++;
+	if (mdev->id_table != NULL) {
+		while (mdev->id_table[i].device) {
+			if (mdev->id_table[i].device <= 63)
+				supported_classes |=
+					BIT_ULL(mdev->id_table[i].device);
+			i++;
+		}
 	}
 
 	if (nla_put_u64_64bit(msg, VDPA_ATTR_MGMTDEV_SUPPORTED_CLASSES,
-- 
2.34.1


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

end of thread, other threads:[~2022-04-28  7:15 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-25  6:27 [PATCH v2 1/2] vdpa: add the check for id_table in struct vdpa_mgmt_dev Cindy Lu
2022-04-25  8:59 ` Jason Wang
2022-04-25  8:59   ` Jason Wang
2022-04-27  2:01   ` Cindy Lu
2022-04-27  4:03     ` Jason Wang
2022-04-27  4:03       ` Jason Wang
2022-04-28  1:56       ` Cindy Lu
2022-04-28  3:07         ` Jason Wang
2022-04-28  3:07           ` Jason Wang
2022-04-28  3:21           ` Cindy Lu
2022-04-28  3:45             ` Jason Wang
2022-04-28  3:45               ` Jason Wang
2022-04-28  7:14               ` Cindy Lu

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.