Re: [PATCH 2/2] init: Combine blacklist entry allocations in initcall_blacklist()

From: Andrew Morton

Date: Sun Nov 15 2026 - 10:18:00 EST


On Sun, 15 Nov 2026 15:23:21 +0100 Thorsten Blum <blum@xxxxxxxxxx> wrote:

> Use a flexible array member for the function name and allocate it
> together with the blacklist entry. This removes the pointer and saves
> one allocation call per blacklist entry.
>

Looks OK, thanks.

> --- a/init/main.c
> +++ b/init/main.c
> @@ -1266,7 +1267,7 @@ static void __init do_ctors(void)
> #ifdef CONFIG_KALLSYMS
> struct blacklist_entry {
> struct list_head next;
> - char *buf;
> + char buf[];
> };

We need some care with the flexible arrays. If some code does a struct
copy:

struct blacklist_entry bl1 = bl2;

then the old code would have worked but after this change bl1 has
garbage in its buf[].

afaict none of our static checking tools (gcc, clang, smatch, sparse)
will catch this.