mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Dan Carpenter <error27@gmail.com>
Cc: Ricardo Ribalda <ribalda@chromium.org>,
	Hans de Goede <hansg@kernel.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil@kernel.org>, Yunke Cao <yunkec@google.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] media: uvcvideo: Fix buffer overflow in uvc_mapping_get_menu_value()
Date: Mon, 28 Sep 2026 23:31:05 +0300	[thread overview]
Message-ID: <20260928203105.GJ4406@killaraus.ideasonboard.com> (raw)
In-Reply-To: <aq0siVcghDe6x9cs@stanley.mountain>

On Fri, Sep 18, 2026 at 03:20:25PM +0300, Dan Carpenter wrote:
> The "idx" value is a user controlled u32 so we have to bounds check it
> before calling test_bit() to avoid reading beyond the end of the bitmap.
> 
> Fixes: 4e15c535659b ("media: uvcvideo: Support any size for mapping get/set")
> Signed-off-by: Dan Carpenter <error27@gmail.com>

What's the status of this patch ? The issue is a false positive, do you
still think there's value in this redundant test ?

> ---
>  drivers/media/usb/uvc/uvc_ctrl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
> index 3ca108b83f1d..f157ed99be4e 100644
> --- a/drivers/media/usb/uvc/uvc_ctrl.c
> +++ b/drivers/media/usb/uvc/uvc_ctrl.c
> @@ -538,7 +538,7 @@ static void uvc_mapping_set_s32(struct uvc_control_mapping *mapping,
>  static int uvc_mapping_get_menu_value(const struct uvc_control_mapping *mapping,
>  				      u32 idx)
>  {
> -	if (!test_bit(idx, &mapping->menu_mask))
> +	if (idx >= BITS_PER_LONG || !test_bit(idx, &mapping->menu_mask))
>  		return -EINVAL;
>  
>  	if (mapping->menu_mapping)

-- 
Regards,

Laurent Pinchart

  parent reply	other threads:[~2026-09-28 20:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-18 12:20 Dan Carpenter
2026-09-18 12:59 ` Ricardo Ribalda
2026-09-18 13:18   ` Dan Carpenter
2026-09-18 13:46     ` Ricardo Ribalda
2026-09-18 16:15       ` Dan Carpenter
2026-09-28 20:31 ` Laurent Pinchart [this message]
2026-09-29  5:29   ` Dan Carpenter

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=20260928203105.GJ4406@killaraus.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=error27@gmail.com \
    --cc=hansg@kernel.org \
    --cc=hverkuil@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ribalda@chromium.org \
    --cc=yunkec@google.com \
    /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

all inboxes | Powered by JetHome®