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>
This commit is contained in:
Hangyu Hua 2022-03-24 10:13:08 +01:00 committed by Mauro Carvalho Chehab
parent 261f33388c
commit 1c8af8e937

View File

@ -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) {