summaryrefslogtreecommitdiffstats
path: root/drivers/media/usb/uvc
diff options
context:
space:
mode:
authorHangyu Hua <hbh25y@gmail.com>2022-03-24 10:13:08 +0100
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-05-08 07:09:12 +0200
commit1c8af8e93748d173b6eac55108455aca18bd93c9 (patch)
tree42e1b0c6a3a7e29d1ef43c1825ef03d36c41fce2 /drivers/media/usb/uvc
parent261f33388c29f6f3c12a724e6d89172b7f6d5996 (diff)
downloadlinux-1c8af8e93748d173b6eac55108455aca18bd93c9.tar.bz2
media: uvcvideo: Fix bit overflow in uvc_probe_video
probe->dwMaxPayloadTransferSize is a 32bit value, but bandwidth is 16bit. This may lead to a bit overflow. Signed-off-by: Hangyu Hua <hbh25y@gmail.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/usb/uvc')
-rw-r--r--drivers/media/usb/uvc/uvc_video.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
index 1b4cc934109e..e016f88bdf96 100644
--- a/drivers/media/usb/uvc/uvc_video.c
+++ b/drivers/media/usb/uvc/uvc_video.c
@@ -383,7 +383,6 @@ int uvc_probe_video(struct uvc_streaming *stream,
struct uvc_streaming_control *probe)
{
struct uvc_streaming_control probe_min, probe_max;
- u16 bandwidth;
unsigned int i;
int ret;
@@ -421,8 +420,7 @@ int uvc_probe_video(struct uvc_streaming *stream,
if (stream->intf->num_altsetting == 1)
break;
- bandwidth = probe->dwMaxPayloadTransferSize;
- if (bandwidth <= stream->maxpsize)
+ if (probe->dwMaxPayloadTransferSize <= stream->maxpsize)
break;
if (stream->dev->quirks & UVC_QUIRK_PROBE_MINMAX) {