Re: [PATCH 08/14] tracing: Switch trace_events_trigger.c code over to use guard()

From: Steven Rostedt
Date: Fri Dec 20 2024 - 08:37:56 EST


On Thu, 19 Dec 2024 15:12:06 -0500
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> @@ -288,28 +280,22 @@ static ssize_t event_trigger_regex_write(struct file *file,
>
> buf = memdup_user_nul(ubuf, cnt);
> if (IS_ERR(buf))
> - return PTR_ERR(buf);
> + return PTR_ERR(no_free_ptr(buf));
>

I just realized that __free(kfree) is defined as:

DEFINE_FREE(kfree, void *, if (!IS_ERR_OR_NULL(_T)) kfree(_T))

where it can handle IS_ERR(), so the above doesn't need that no_free_ptr(buf).

-- Steve