[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANiDSCuprLdo0i2VE3Vhe=t9cSYwW_Czvyyps=nOqLmrWn_uJA@mail.gmail.com>
Date: Fri, 25 Mar 2022 16:37:21 +0100
From: Ricardo Ribalda <ribalda@...omium.org>
To: Hangyu Hua <hbh25y@...il.com>
Cc: laurent.pinchart@...asonboard.com, mchehab@...nel.org,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] media: uvc_video: fix bit overflow in uvc_probe_video
On Fri, 25 Mar 2022 at 16:34, Hangyu Hua <hbh25y@...il.com> wrote:
>
> probe->dwMaxPayloadTransferSize is a 32bit value, but bandwidth is 16bit. This
> may lead to a bit overflow.
>
> Fix this by using probe->dwMaxPayloadTransferSize directly.
>
> Signed-off-by: Hangyu Hua <hbh25y@...il.com>
Reviewed-by: Ricardo Ribalda <ribalda@...omium.org>
> ---
>
> v2:
> Use probe->dwMaxPayloadTransferSize directly instead of changing temporary
> variable.
>
> drivers/media/usb/uvc/uvc_video.c | 4 +---
> 1 file changed, 1 insertion(+), 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) {
> --
> 2.25.1
>
--
Ricardo Ribalda
Powered by blists - more mailing lists