vdpa: Consider device id larger than 31
PATCH 1/1 vdpa: Consider device id larger than 31
virtio device id value can be more than 31. Hence, use BIT_ULL in assignment.
Fixes 33b347503f01 ("vdpa: Define vdpa mgmt device, ops and a netlink interface")
Reported-by kernel test robot <[email protected]>
Reported-by Dan Carpenter <[email protected]>
Signed-off-by Parav Pandit <[email protected]>
Acked-by Jason Wang <[email protected]>
---
changelog:v0->v1:
- supporting device id up to 63
--- drivers/vdpa/vdpa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/vdpa/vdpa.c +2 -1
@@ -404,7 +404,8 @@ static int vdpa_mgmtdev_fill(const struct vdpa_mgmt_dev *mdev, struct sk_buff *m goto msg_err;while (mdev->id_table[i].device) { - supported_classes |=BIT (mdev->id_table[i].device); +if (mdev->id_table[i].device <=63 ) + supported_classes |=BIT_ULL (mdev->id_table[i].device); i++; }
Signature · 1 line
2.26.2
Michael S. Tsirkin
maintainerQuoted 21 lines · Parav Pandit
virtio device id value can be more than 31. Hence, use
BIT_ULLin assignment.Fixes 33b347503f01 ("vdpa: Define vdpa mgmt device, ops and a netlink interface")Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>Signed-off-by Parav Pandit <[email protected]>Acked-by Jason Wang <[email protected]>---
changelog:v0->v1:
- supporting device id up to 63--- drivers/vdpa/vdpa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/vdpa/vdpa.c +0
-0
drivers/vdpa/vdpa.c static int vdpa_mgmtdev_fill(const struct vdpa_mgmt_dev *mdev, struct sk_buff *m · line 410
Quoted 8 lines
drivers/vdpa/vdpa.c +2
-1@@ -404,7 +404,8 @@ static int vdpa_mgmtdev_fill(const struct vdpa_mgmt_dev *mdev, struct sk_buff *m goto msg_err;while (mdev->id_table[i].device) { - supported_classes |=BIT (mdev->id_table[i].device); +if (mdev->id_table[i].device <=63 ) + supported_classes |=BIT_ULL (mdev->id_table[i].device); i++; }
Not for this release, but a for loop will be cleaner here.
Quoted 2 lines
Signature · 1 line
2.26.2