[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230718100246.87e2ad49bfd8fa056b3db2ef@kernel.org>
Date: Tue, 18 Jul 2023 10:02:46 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.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 Mon, 17 Jul 2023 19:51:29 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:
> 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".
Ah, got it! Let me update it.
Thank you!
>
> -- 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);
> > > > +
--
Masami Hiramatsu (Google) <mhiramat@...nel.org>
Powered by blists - more mailing lists