Re: [PATCH v3 01/11] gpu: nova-core: vbios: fix various cases of reading past `BIOS_MAX_SCAN_LEN`

Eliot Courtney
2026-05-01T05:15:52Z

On Wed Apr 29, 2026 at 11:32 PM JST, Joel Fernandes wrote:
>
>
> On 4/29/2026 9:24 AM, Alexandre Courbot wrote:
>> On Tue Apr 21, 2026 at 5:20 PM JST, Eliot Courtney wrote:
>>> Fix various cases that allow reading past `BIOS_MAX_SCAN_LEN` when
>>> scanning the VBIOS.
>>>
>>> Fix bug where `read_more_at_offset` would unnecessarily read more data.
>>> This happens when the window to read has some part cached and some part
>>> not. It would read `len` bytes instead of just the uncached portion,
>>> which could read past `BIOS_MAX_SCAN_LEN`.
>>>
>>> Also add more checked arithmetic to catch potential overflows.
>>> `read_bios_image_at_offset` is called with a length from the VBIOS
>>> header, so we should be more defensive here.
>>
>> This reads like this patch is doing 3 different things, or at least two,
>> since the second chunk (`read_bios_image_at_offset`) does not seem
>> related to `BIOS_MAX_SCAN_LEN`.
>>
>> The general rule is that one patch should do one thing - the trick here
>> will be to either update the message to describe a larger thing (and not
>> 3 small ones), or to split the patch. Both are acceptable IMHO.
>
> I thought about that too but didn't say it because it seemed the other
> changes were just 2-3 lines and generally same 'functional area'. However,
> I agree with Alex, perhaps splitting into 1 for BIOS_MAX_SCAN_LEN and
> another for checked_add makes sense.

Thanks all, I have split this into three patches.

>
>>
>>>
>>> Fixes: 6fda04e7f0cd ("gpu: nova-core: vbios: Add base support for VBIOS construction and iteration")
>>> Reviewed-by: Joel Fernandes <joelagnelf@nvidia.com>
> Feel free to still carry my tag either way.

Thanks. It's a pure split with no code changes so I have carried your
reviewed by for each.

>
> Thanks.