[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z65wb-8B2RlPi7Uw@bombadil.infradead.org>
Date: Thu, 13 Feb 2025 14:21:35 -0800
From: Luis Chamberlain <mcgrof@...nel.org>
To: Thorsten Blum <thorsten.blum@...ux.dev>
Cc: Kees Cook <kees@...nel.org>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Petr Pavlu <petr.pavlu@...e.com>,
Thomas Weißschuh <linux@...ssschuh.net>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Nathan Chancellor <nathan@...nel.org>, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [RESEND PATCH v2] params: Annotate struct module_param_attrs
with __counted_by()
On Thu, Feb 13, 2025 at 11:13:52PM +0100, 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.
>
> Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> Cc: Luis Chamberlain <mcgrof@...nel.org>
> Cc: Nathan Chancellor <nathan@...nel.org>
> Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
Reviewed-by: Luis Chamberlain <mcgrof@...nel.org>
Luis
Powered by blists - more mailing lists