From: Dan Carpenter <dan.carpenter@linaro.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Costa Shulyupin <costa.shul@redhat.com>,
Daniel Bristot de Oliveira <bristot@kernel.org>,
John Kacur <jkacur@redhat.com>,
"Luis Claudio R. Goncalves" <lgoncalv@redhat.com>,
Eder Zulian <ezulian@redhat.com>,
Tomas Glozar <tglozar@redhat.com>,
Gabriele Monaco <gmonaco@redhat.com>,
linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] tools/rtla: Add osnoise_trace_is_off()
Date: Fri, 17 Jan 2025 08:08:10 +0300 [thread overview]
Message-ID: <435c4d70-3a7a-41d2-b49a-9de7cdb77c14@stanley.mountain> (raw)
In-Reply-To: <20250116193432.716db3a2@gandalf.local.home>
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@linaro.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
prev parent reply other threads:[~2025-01-17 5:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-15 17:58 [PATCH v4] tools/rtla: Add osnoise_trace_is_off() Costa Shulyupin
2025-01-15 18:40 ` Dan Carpenter
2025-01-17 0:34 ` Steven Rostedt
2025-01-17 5:08 ` Dan Carpenter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=435c4d70-3a7a-41d2-b49a-9de7cdb77c14@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=bristot@kernel.org \
--cc=costa.shul@redhat.com \
--cc=ezulian@redhat.com \
--cc=gmonaco@redhat.com \
--cc=jkacur@redhat.com \
--cc=lgoncalv@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglozar@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox