On Fri, Sep 13, 2024 at 09:03:06PM +0200, Thorsten Blum wrote:
> On 13. Sep 2024, at 20:40, Andy Shevchenko 
> <[email protected]> wrote:
> > On Fri, Sep 13, 2024 at 09:46:30AM -0700, Nathan Chancellor wrote:
> >> On Mon, Sep 09, 2024 at 06:27:26PM +0200, Thorsten Blum wrote:
> >>> Add the __counted_by compiler attribute to the flexible array member
> >>> attrs to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
> >>> CONFIG_FORTIFY_SOURCE.
> >>> 
> >>> Increment num before adding a new param_attribute to the attrs array and
> >>> adjust the array index accordingly. Increment num immediately after the
> >>> first reallocation such that the reallocation for the NULL terminator
> >>> only needs to add 1 (instead of 2) to mk->mp->num.
> >>> 
> >>> Use struct_size() instead of manually calculating the size for the
> >>> reallocation.
> >>> 
> >>> Use krealloc_array() for the additional NULL terminator.
> > 
> >>> /* Fix up all the pointers, since krealloc can move us */
> >>> for (i = 0; i < mk->mp->num; i++)
> > 
> > Shouldn't this for loop and followed by assignment also be -1:ed?
> 
> That should be fine as mk->mp->num was already incremented before the
> for-loop.

Exactly my point. This is behavioural change AFAICS as the original code used
the old (-1:ed) value, no?

-- 
With Best Regards,
Andy Shevchenko



Reply via email to