From: Hans de Goede <hansg@kernel.org>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Ricardo Ribalda <ribalda@chromium.org>
Cc: Sergey Shtylyov <s.shtylyov@auroraos.dev>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org
Subject: Re: [PATCH] media: uvcvideo: drop useless assignment in uvc_parse_format()
Date: Tue, 29 Sep 2026 11:16:31 +0200 [thread overview]
Message-ID: <206c3a0e-013c-4350-aa70-eac96e045784@kernel.org> (raw)
In-Reply-To: <20260928202948.GI4406@killaraus.ideasonboard.com>
Hi,
On 28-Sep-26 22:29, Laurent Pinchart wrote:
> 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
Ack, I've dropped this patch from patchwork.
Regards,
Hans
>
>>> 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;
>
next prev parent reply other threads:[~2026-09-29 9:16 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
2026-09-29 9:16 ` Hans de Goede [this message]
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=206c3a0e-013c-4350-aa70-eac96e045784@kernel.org \
--to=hansg@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox