[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20180403234153.7bd44567305ca11cead0e35b@kernel.org>
Date: Tue, 3 Apr 2018 23:41:53 +0900
From: Masami Hiramatsu <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Tom Zanussi <tom.zanussi@...ux.intel.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
linux-trace-users@...r.kernel.org, linux-kselftest@...r.kernel.org,
shuah@...nel.org, Ravi Bangoria <ravi.bangoria@...ux.vnet.ibm.com>
Subject: Re: [PATCH v6 10/21] tracing: probeevent: Return consumed bytes of
dynamic area
On Mon, 2 Apr 2018 16:02:07 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:
> On Sat, 17 Mar 2018 21:44:52 +0900
> Masami Hiramatsu <mhiramat@...nel.org> wrote:
>
> > -static nokprobe_inline void
> > -fetch_store_string(unsigned long addr, void *dest)
> > +static nokprobe_inline int
> > +fetch_store_string(unsigned long addr, void *dest, void *base)
> > {
> > - int maxlen = get_rloc_len(*(u32 *)dest);
> > - u8 *dst = get_rloc_data(dest);
> > + int maxlen = get_loc_len(*(u32 *)dest);
> > + u8 *dst = get_loc_data(dest, base);
> > long ret;
> >
> > if (!maxlen)
> > - return;
> > + return -ENOMEM;
> >
> > /*
> > * Try to get string again, since the string can be changed while
> > @@ -854,19 +851,19 @@ fetch_store_string(unsigned long addr, void *dest)
> >
> > if (ret < 0) { /* Failed to fetch string */
> > dst[0] = '\0';
> > - *(u32 *)dest = make_data_rloc(0, get_rloc_offs(*(u32 *)dest));
> > - } else {
> > - *(u32 *)dest = make_data_rloc(ret, get_rloc_offs(*(u32 *)dest));
> > + ret = 0;
>
> Why do you return 0 here and not the error value? You return -ENOMEM
> above if maxlen is zero.
Good catch! it should clear dst[0] and return 0 even if no buffer remains...
OK, I'll fix it.
Thank you!
>
> -- Steve
>
> > }
> > + *(u32 *)dest = make_data_loc(ret, (void *)dst - base);
> > + return ret;
> > }
--
Masami Hiramatsu <mhiramat@...nel.org>
Powered by blists - more mailing lists