Re: [PATCH] net: kunit: move struct net_devmem_dmabuf_binding off stack
From: Mina Almasry
Date: Fri Nov 13 2026 - 16:00:16 EST
On Fri, Nov 13, 2026 at 2:11 AM Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
>
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> The net_devmem_dmabuf_binding structure is really way too big to
> live on the stack, and causes warnings on my randconfig build machine
> with a reasonable per-function limit:
>
> net/core/net_test.c: In function 'netmem_ref_test_tcp_devmem_recv':
> net/core/net_test.c:1720:1: error: the frame size of 1744 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
> 1720 | }
> | ^
> net/core/net_test.c: In function 'netmem_ref_test_skb_segment':
> net/core/net_test.c:1477:1: error: the frame size of 1584 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
>
> Since the binding object is never used concurrently in multiple tests,
> avoid this by just having a global copy of it and reinitializing it
> for every user.
>
> Fixes: 2285346afc99 ("net: kunit: test netmem, page_pool, and skb frag refcounting")
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> ---
> I don't particularly like this workaround, as global variables are
> always hacky like this. If anyone has a better idea to avoid the
> last stack structure, let's do that instead.
>
> Without the patch, I run into this every few randconfig builds,
> which did not happen on linux-next before the merge window.
>
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
kunit_kzalloc() may work, but it requires `s/binding\./binding->/`
across the test cases. Either way is fine by me, this minimal fix
works well too:
Reviewed-by: Mina Almasry <almasrymina@xxxxxxxxxx>
--
Thanks,
Mina