[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <B46D6F09-6F81-45B3-833F-9785BBBC146F@toblux.com>
Date: Fri, 13 Sep 2024 21:03:06 +0200
From: Thorsten Blum <thorsten.blum@...lux.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Nathan Chancellor <nathan@...nel.org>,
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 13. Sep 2024, at 20:40, Andy Shevchenko <andriy.shevchenko@...ux.intel.com> 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.
Powered by blists - more mailing lists