Re: [PATCH v3 2/5] tracing: Use __free() in trace_probe for cleanup

Steven Rostedt
2025-01-07T15:35:17Z

On Tue, 7 Jan 2025 20:50:25 +0900
"Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:

> @@ -1790,18 +1777,15 @@ int traceprobe_expand_dentry_args(int argc, const char *argv[], char **buf)
> offsetof(struct file, f_path.dentry),
> equal ? equal + 1 : tmp);
>
> - kfree(tmp);
> + kfree(no_free_ptr(tmp));

I don't get this? You are telling the compiler not to free tmp, because you
decided to free it yourself? Why not just remove the kfree() here altogether?

-- Steve

> if (ret >= bufsize - used)
> - goto nomem;
> + return -ENOMEM;
> argv[i] = tmpbuf + used;
> used += ret + 1;
> }
>
> - *buf = tmpbuf;
> + *buf = no_free_ptr(tmpbuf);
> return 0;
> -nomem:
> - kfree(tmpbuf);
> - return -ENOMEM;
> }