From: Hangyu Hua <hbh25y@gmail.com>
To: laurent.pinchart@ideasonboard.com, mchehab@kernel.org
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
Hangyu Hua <hbh25y@gmail.com>
Subject: [PATCH] media: uvc_video: fix bit overflow in uvc_probe_video
Date: Thu, 24 Mar 2022 17:13:08 +0800 [thread overview]
Message-ID: <20220324091308.44799-1-hbh25y@gmail.com> (raw)
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>
---
drivers/media/usb/uvc/uvc_video.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
index 1b4cc934109e..cc4878373aa7 100644
--- a/drivers/media/usb/uvc/uvc_video.c
+++ b/drivers/media/usb/uvc/uvc_video.c
@@ -383,7 +383,7 @@ int uvc_probe_video(struct uvc_streaming *stream,
struct uvc_streaming_control *probe)
{
struct uvc_streaming_control probe_min, probe_max;
- u16 bandwidth;
+ u32 bandwidth;
unsigned int i;
int ret;
@@ -422,7 +422,7 @@ int uvc_probe_video(struct uvc_streaming *stream,
break;
bandwidth = probe->dwMaxPayloadTransferSize;
- if (bandwidth <= stream->maxpsize)
+ if (bandwidth <= (u32)stream->maxpsize)
break;
if (stream->dev->quirks & UVC_QUIRK_PROBE_MINMAX) {
--
2.25.1
next reply other threads:[~2022-03-24 9:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-24 9:13 Hangyu Hua [this message]
2022-03-24 13:52 ` [PATCH] media: uvc_video: fix bit overflow in uvc_probe_video Laurent Pinchart
2022-03-25 1:35 ` Hangyu Hua
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220324091308.44799-1-hbh25y@gmail.com \
--to=hbh25y@gmail.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).