From: shaikh kamaluddin <shaikhkamal2012@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: dan.j.williams@intel.com, Davidlohr Bueso <dave@stgolabs.net>,
Jonathan Cameron <jonathan.cameron@huawei.com>,
Dave Jiang <dave.jiang@intel.com>,
Alison Schofield <alison.schofield@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Ira Weiny <ira.weiny@intel.com>,
Shiju Jose <shiju.jose@huawei.com>,
"Fabio M. De Francesco" <fabio.m.de.francesco@linux.intel.com>,
Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>,
linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [PATCH] cxl: trace: Fix macro safety in CXL_EVT_TP_fast_assign
Date: Thu, 24 Apr 2025 21:17:28 +0530 [thread overview]
Message-ID: <72d355b4-73f8-458d-99e8-8e4f02d5dd79@gmail.com> (raw)
In-Reply-To: <20250421151239.7981f1fa@gandalf.local.home>
On 4/22/25 00:42, Steven Rostedt wrote:
> On Tue, 22 Apr 2025 00:15:17 +0530
> "shaikh.kamal" <shaikhkamal2012@gmail.com> wrote:
>
>> Fix checkpatch.pl detected error
> First, checkpatch.pl should never be used on existing code unless it's
> yours. As the name suggests, it's for checking patches. It's not to check
> what's already been accepted. Please do not submit patches against accepted
> code because of what checkpatch.pl reports.
Thanks for your suggestion.
>
> If you run it on code and it reports something that you find is a real bug,
> then sure, fix it. But don't submit patches on code you do not understand
> just because checkpatch.pl says there's an issue with it.
Okay got it.
>
>> The CXL_EVT_TP_fast_assign macro assigns multiple fields, but does not
>> wrap the body in a `do { ... } while (0)` block. This can lead to
>> unexpected behavior when used in conditional branches.
> Next, this is not a normal macro. It's a trace event macro and
> checkpatch.pl fails miserably on pretty much all tracing macros.
>
> Thanks for your comments.
>
>> Add checks to ensure cxlmd is valid before accessing its fields.
> If it is invalid, and we do what your patch suggests and just not write
> anything, the event it was writing into has already been created. If we
> exit out of this macro, then the event will simply contain garbage, but is
> already on its way to user space. That means the output to user space will
> be garbage. That's a bug. In other words, if cxlmd is NULL, it had better
> not be calling this macro in the fist place!
>
> -- Steve
> Thanks for your suggestions and comments.
next prev parent reply other threads:[~2025-04-24 15:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-21 18:45 [PATCH] [PATCH] cxl: trace: Fix macro safety in CXL_EVT_TP_fast_assign shaikh.kamal
2025-04-21 19:12 ` Steven Rostedt
2025-04-24 15:47 ` shaikh kamaluddin [this message]
2025-04-23 21:52 ` Ira Weiny
2025-04-24 15:48 ` shaikh kamaluddin
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=72d355b4-73f8-458d-99e8-8e4f02d5dd79@gmail.com \
--to=shaikhkamal2012@gmail.com \
--cc=Smita.KoralahalliChannabasappa@amd.com \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=fabio.m.de.francesco@linux.intel.com \
--cc=ira.weiny@intel.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=shiju.jose@huawei.com \
--cc=vishal.l.verma@intel.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