[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZuHaiiMV6ESS8p7z@bombadil.infradead.org>
Date: Wed, 11 Sep 2024 10:59:38 -0700
From: Luis Chamberlain <mcgrof@...nel.org>
To: Thorsten Blum <thorsten.blum@...lux.com>
Cc: kees@...nel.org, gustavoars@...nel.org,
andriy.shevchenko@...ux.intel.com, 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 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.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@...lux.com>
> ---
> Changes in v2:
> - Use krealloc_array() as suggested by Andy Shevchenko
> - Link to v1: https://lore.kernel.org/linux-kernel/20240823123300.37574-1-thorsten.blum@toblux.com/
Applied and pushed to modules-next, thanks!
Luis
Powered by blists - more mailing lists