]> git.baikalelectronics.ru Git - kernel.git/commit
drm/virtio: fix potential integer overflow on shift of a int
authorColin Ian King <colin.king@canonical.com>
Thu, 30 Sep 2021 10:19:41 +0000 (11:19 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 29 Oct 2021 06:26:23 +0000 (08:26 +0200)
commitd1ceb57f856bef3548ca2d384884a828995ab76d
treedafb4a4369893aa19bcfe927529111cc8736fb57
parentd825122bf37a1e945320fb747c2db3c26018ff8f
drm/virtio: fix potential integer overflow on shift of a int

The left shift of unsigned int 32 bit integer constant 1 is evaluated
using 32 bit arithmetic and then assigned to a signed 64 bit integer.
In the case where i is 32 or more this can lead to an overflow. Fix
this by shifting the value 1ULL instead.

Addresses-Coverity: ("Uninitentional integer overflow")
Fixes: 5a4ee41c820f ("drm/virtio: implement context init: handle VIRTGPU_CONTEXT_PARAM_POLL_RINGS_MASK")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20210930101941.16546-1-colin.king@canonical.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
drivers/gpu/drm/virtio/virtgpu_ioctl.c