aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHangyu Hua <[email protected]>2022-03-24 10:13:08 +0100
committerMauro Carvalho Chehab <[email protected]>2022-05-08 07:09:12 +0200
commit1c8af8e93748d173b6eac55108455aca18bd93c9 (patch)
tree42e1b0c6a3a7e29d1ef43c1825ef03d36c41fce2
parent261f33388c29f6f3c12a724e6d89172b7f6d5996 (diff)
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 <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
-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) {