Re: [PATCH] perf bench numa: add NULL check after calloc()

From: Arnaldo Carvalho de Melo

Date: Fri Sep 25 2026 - 10:31:44 EST


On Wed, Sep 02, 2026 at 03:09:13PM +0800, longlong yan wrote:
> Two calloc() calls in the numa benchmark lack NULL return checks,
> leading to potential NULL pointer dereferences on allocation failure:
>
> 1. worker_process(): the allocated `pthreads` array is used in the
> following for-loop via pthreads[t] without checking for NULL.
>
> 2. __bench_numa(): the allocated `pids` array is used in the following
> for-loop via pids[i] without checking for NULL.
>
> Add BUG_ON() checks after each calloc(), consistent with the existing
> NULL check style used elsewhere in the same file (e.g., node_present
> and nodes allocations).

Thanks, applied to perf-tools-next, for v7.4.

- Arnaldo