Re: [PATCH bpf-next v1 06/14] selftests/bpf: Fix cleanup in check_fd_array_cnt__fd_array_too_big()

From: Eduard Zingerman

Date: Thu Feb 12 2026 - 18:17:43 EST


On Wed, 2026-02-11 at 17:13 -0800, Ihor Solodrai wrote:
> The Close() macro uses the passed in expression three times, which
> leads to repeated execution in case it has side effects. That is,
> Close(i--) would decrement i three times.
>
> ASAN caught a stack-buffer-undeflow error at a point where this was
> overlooked. Fix it.
>
> Signed-off-by: Ihor Solodrai <ihor.solodrai@xxxxxxxxx>
> ---

Acked-by: Eduard Zingerman <eddyz87@xxxxxxxxx>

(However, in bpf headers the common pattern is to define a variable
in the macro body, something like `int ___fd = (FD);).

[...]