[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250116193432.716db3a2@gandalf.local.home>
Date: Thu, 16 Jan 2025 19:34:32 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Dan Carpenter <dan.carpenter@...aro.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 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.
-- Steve
Powered by blists - more mailing lists