Re: [PATCH] tracing: Fix field_var_str allocation errno

From: Steven Rostedt

Date: Fri May 29 2026 - 11:45:05 EST


On Tue, 26 May 2026 17:50:22 +0800
Yu Peng <pengyu@xxxxxxxxxx> wrote:

> hist_trigger_elt_data_alloc() returns -EINVAL when the field_var_str
> kcalloc() fails. Return -ENOMEM instead, matching the other allocation
> failures in the function.
>
> Fixes: c910db943d35 ("tracing: Dynamically allocate the per-elt hist_elt_data array")
> Signed-off-by: Yu Peng <pengyu@xxxxxxxxxx>
> ---
> kernel/trace/trace_events_hist.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
> index eb2c2bc8bc3d..17fe13e12a4f 100644
> --- a/kernel/trace/trace_events_hist.c
> +++ b/kernel/trace/trace_events_hist.c
> @@ -1680,7 +1680,7 @@ static int hist_trigger_elt_data_alloc(struct tracing_map_elt *elt)
> elt_data->field_var_str = kcalloc(n_str, sizeof(char *), GFP_KERNEL);
> if (!elt_data->field_var_str) {
> hist_elt_data_free(elt_data);
> - return -EINVAL;
> + return -ENOMEM;
> }
> elt_data->n_field_var_str = n_str;
>

Thanks but this code is made obsolete by this patch that I'm pulling in:

https://lore.kernel.org/all/20260522214407.18120-1-rosenp@xxxxxxxxx/

-- Steve