Re: [PATCH v3 2/3] media: uvcvideo: Fix integer overflow in frame buffer size calculation

From: Natasha Klaus

Date: Wed Sep 30 2026 - 04:59:39 EST


On Mon, Sep 28, 2026, Laurent Pinchart wrote:
> Is this patch missing an Assisted-by tag ?

Yes, and I should have disclosed it in v3. I used Claude Code for
this series:

- 1/3: Ricardo's design, from his diff on the list. Claude Code
applied it, found it did not build (alts left unused) and wrote
the dev_warn() text.
- 3/3: my design (skip rather than reject, inside the uncompressed
branch, same approach as 81f3affa19d6). Claude Code wrote the code,
I wrote the comment.
- Commit messages and notes: drafted by Claude Code from a list of
required content I gave it, then edited by me. In 2/3 this covers
my changes to Noam's text, not his original.
- Analysis: the call path analysis in my review mails and the zero
size case behind 3/3 were found by Claude Code. I spot-checked
them against the tree.

I reviewed and approved every change and built each commit. v4 will
carry Assisted-by on all three patches, say in 3/3 how the zero size
case was found, and describe the tool use in the cover letter.

The original patch in 2/3 is Noam's. I have asked him to answer for
his part.

> I also want to know what device this has been tested with.

No physical device. Only Noam's UVC gadget over dummy_hcd, details
in my reply on 1/3.

> > + bufsize = DIV_ROUND_UP_ULL((u64)format->bpp * frame->wWidth *
> > + frame->wHeight, BITS_PER_BYTE);
>
> See the reply I just sent on v1.

Thanks for the numbers. If width * bpp is always a multiple of 8,
rounding up and truncating give the same result on any real device.
They differ only for descriptors that are already broken. I kept
DIV_ROUND_UP_ULL to match the FORCE_BPP path in uvc_parse_format().
I can go back to a plain shift if you prefer. Which one do you want
in v4?

Natasha