Skip to content

Commit

Permalink
virtio-gpu: fix shift wrapping bug in virtio_gpu_fence_event_create()
Browse files Browse the repository at this point in the history
[ Upstream commit 37a7844 ]

The ->ring_idx_mask variable is a u64 so static checkers, Smatch in
this case, complain if the BIT() is not also a u64.

drivers/gpu/drm/virtio/virtgpu_ioctl.c:50 virtio_gpu_fence_event_create()
warn: should '(1 << ring_idx)' be a 64 bit type?

Fixes: cd7f5ca ("drm/virtio: implement context init: add virtio_gpu_fence_event")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/YygN7jY0GdUSQSy0@kili
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Dan Carpenter authored and gregkh committed Oct 21, 2022
1 parent 53066b1 commit 2945f0a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/virtio/virtgpu_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static int virtio_gpu_fence_event_create(struct drm_device *dev,
struct virtio_gpu_fence_event *e = NULL;
int ret;

if (!(vfpriv->ring_idx_mask & (1 << ring_idx)))
if (!(vfpriv->ring_idx_mask & BIT_ULL(ring_idx)))
return 0;

e = kzalloc(sizeof(*e), GFP_KERNEL);
Expand Down

0 comments on commit 2945f0a

Please sign in to comment.