[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230717195129.14759151@gandalf.local.home>
Date: Mon, 17 Jul 2023 19:51:29 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: "Masami Hiramatsu (Google)" <mhiramat@...nel.org>
Cc: linux-trace-kernel@...r.kernel.org, linux-kernel@...r.kernel.org,
Martin KaFai Lau <martin.lau@...ux.dev>, bpf@...r.kernel.org,
Sven Schnelle <svens@...ux.ibm.com>,
Alexei Starovoitov <ast@...nel.org>
Subject: Re: [PATCH v2 2/9] bpf/btf: tracing: Move finding func-proto API
and getting func-param API to BTF
On Tue, 18 Jul 2023 08:46:34 +0900
Masami Hiramatsu (Google) <mhiramat@...nel.org> wrote:
> > > + * Get function parameter with the number of parameters.
> > > + * This can return NULL if the function has no parameters.
> >
> > " It can return EINVAL if this function's parameters are NULL."
>
> No, as you can see the code, if btf_type_vlen(func_proto) returns 0 (means
> the function proto type has no parameters), btf_get_func_param() returns
> NULL. This is important point because user needs to use IS_ERR_OR_NULL(ret)
> instead of IS_ERR(ret).
I didn't mean to replace what you had, I meant you left that part out. In
other words, you have to check for IS_ERR_OR_NULL(ret), not just "!ret".
-- Steve
> >
> > > + */
> > > +const struct btf_param *btf_get_func_param(const struct btf_type *func_proto, s32 *nr)
> > > +{
> > > + if (!func_proto || !nr)
> > > + return ERR_PTR(-EINVAL);
> > > +
Powered by blists - more mailing lists