From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Sergey Shtylyov <s.shtylyov@auroraos.dev>,
Hans de Goede <hansg@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org
Subject: Re: [PATCH] media: uvcvideo: drop useless assignment in uvc_parse_format()
Date: Mon, 28 Sep 2026 23:29:48 +0300 [thread overview]
Message-ID: <20260928202948.GI4406@killaraus.ideasonboard.com> (raw)
In-Reply-To: <CANiDSCuWc8oUhFgqVMH+4+nzStuPfA5b2Vz+2woXqEu6ob1yOA@mail.gmail.com>
On Thu, Aug 27, 2026 at 11:24:33AM +0200, Ricardo Ribalda wrote:
> Hi Sergey
>
> On Thu, 20 Aug 2026 at 22:12, Sergey Shtylyov <s.shtylyov@auroraos.dev> wrote:
> >
> > Close to the end of uvc_parse_format(), the parameter buflen is decremented
> > (again) but that statement seems pointless as buflen isn't used afterwards.
> > Drop the useless assignment (gcc doesn't generate any code for it anyways).
>
> The patch is correct, although I do not see a great benefit in
> removing it. As you say, the compiler will remove it anyway. If we
> modify the function to add logging or continue parsing the left over
> buffer, it is going to come back to haunt us....
>
> I leave it to Laurent or HansG to decide if they want to merge it.
I'd rather keep the buflen update in place for the reasons explained by
Ricardo.
/me wishes for std::span<> in C
> > Found by Linux Verification Center (linuxtesting.org) with the Svace static
> > analysis tool.
> >
> > Signed-off-by: Sergey Shtylyov <s.shtylyov@auroraos.dev>
> > ---
> > drivers/media/usb/uvc/uvc_driver.c | 1 -
> > 1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> > index e289cc71ba98..0e78e8bcd320 100644
> > --- a/drivers/media/usb/uvc/uvc_driver.c
> > +++ b/drivers/media/usb/uvc/uvc_driver.c
> > @@ -520,7 +520,6 @@ static int uvc_parse_format(struct uvc_device *dev,
> > format->xfer_func = uvc_xfer_func(buffer[4]);
> > format->ycbcr_enc = uvc_ycbcr_enc(buffer[5]);
> >
> > - buflen -= buffer[0];
> > buffer += buffer[0];
> > } else {
> > format->colorspace = V4L2_COLORSPACE_SRGB;
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2026-09-28 20:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-20 20:11 [PATCH] media: uvcvideo: drop useless assignment in uvc_parse_format() Sergey Shtylyov
2026-08-20 20:15 ` Sergey Shtylyov
2026-08-27 9:24 ` Ricardo Ribalda
2026-09-28 20:29 ` Laurent Pinchart [this message]
2026-09-29 9:16 ` Hans de Goede
2026-09-29 14:25 ` Sergey Shtylyov
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=20260928202948.GI4406@killaraus.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=hansg@kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=ribalda@chromium.org \
--cc=s.shtylyov@auroraos.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.