[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <435c4d70-3a7a-41d2-b49a-9de7cdb77c14@stanley.mountain>
Date: Fri, 17 Jan 2025 08:08:10 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Costa Shulyupin <costa.shul@...hat.com>,
Daniel Bristot de Oliveira <bristot@...nel.org>,
John Kacur <jkacur@...hat.com>,
"Luis Claudio R. Goncalves" <lgoncalv@...hat.com>,
Eder Zulian <ezulian@...hat.com>, Tomas Glozar <tglozar@...hat.com>,
Gabriele Monaco <gmonaco@...hat.com>,
linux-trace-kernel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4] tools/rtla: Add osnoise_trace_is_off()
On Thu, Jan 16, 2025 at 07:34:32PM -0500, Steven Rostedt wrote:
> On Wed, 15 Jan 2025 21:40:40 +0300
> Dan Carpenter <dan.carpenter@...aro.org> wrote:
>
> > On Wed, Jan 15, 2025 at 07:58:30PM +0200, Costa Shulyupin wrote:
> > > The original code accidentally works because offset of
> > > `record->trace` is zero.
> >
> > It doesn't "accidentally work". The people who write this kind of
> > code 100% understand what they are doing. They don't see it as
> > anything complicated.
>
> I'm taking this patch but I replaced the change log with the following text:
>
> tools/rtla: Add osnoise_trace_is_off()
>
> All of the users of trace_is_off() passes in &record->trace as the second
> parameter, where record is a pointer to a struct osnoise_tool. This record
> could be NULL and there is a hidden dependency that the trace field is the
> first field to allow &record->trace to work with a NULL record pointer.
>
> In order to make this code a bit more robust, as record shouldn't be
> dereferenced if it is NULL, even if the code does work, create a new
> function called osnoise_trace_is_off() that takes the pointer to a
> struct osnoise_tool as its second parameter. This way it can properly test
> if it is NULL before it dereferences it.
>
> The old function trace_is_off() is removed and the function
> osnoise_trace_is_off() is added into osnoise.c which is what the
> struct osnoise_tool is associated with.
Thanks!
regards,
dan carpenter
Powered by blists - more mailing lists