[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZuSHB2v7OLvagZnn@smile.fi.intel.com>
Date: Fri, 13 Sep 2024 21:40:07 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Nathan Chancellor <nathan@...nel.org>
Cc: Thorsten Blum <thorsten.blum@...lux.com>, kees@...nel.org,
gustavoars@...nel.org, mcgrof@...nel.org,
linux-hardening@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RESEND PATCH v2] params: Annotate struct module_param_attrs
with __counted_by()
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?
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists