From: Steven Rostedt <rostedt@goodmis.org>
To: "Tze-nan Wu (吳澤南)" <Tze-nan.Wu@mediatek.com>
Cc: "zanussi@kernel.org" <zanussi@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-trace-kernel@vger.kernel.org"
<linux-trace-kernel@vger.kernel.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"Cheng-Jui Wang (王正睿)" <Cheng-Jui.Wang@mediatek.com>,
wsd_upstream <wsd_upstream@mediatek.com>,
"Bobule Chang (張弘義)" <bobule.chang@mediatek.com>,
"mhiramat@kernel.org" <mhiramat@kernel.org>,
"eric-yc.wu@mediatek.com" <eric-yc.wu@mediatek.com>,
"mathieu.desnoyers@efficios.com" <mathieu.desnoyers@efficios.com>
Subject: Re: [PATCH RESEND] tracing: Fix overflow in get_free_elt()
Date: Wed, 7 Aug 2024 09:29:36 -0400 [thread overview]
Message-ID: <20240807092936.1661ce6a@gandalf.local.home> (raw)
In-Reply-To: <52e8ccc5dd82668c17877c97fb96f255dc2e7052.camel@mediatek.com>
On Wed, 7 Aug 2024 11:34:43 +0000
Tze-nan Wu (吳澤南) <Tze-nan.Wu@mediatek.com> wrote:
> > > -idx = atomic_inc_return(&map->next_elt);
> > > +idx = atomic_fetch_add_unless(&map->next_elt, 1, map->max_elts);
> >
> > I guess we need to add (with a comment):
> >
> > idx--;
> >
> Thanks for reviewing this!
>
> By reference to "/include/linux/atomic/atomic-instrumented.h",
> `atomic_fetch_add_unless` will return the original value before the
> adding happens on operands.
Ah, right. I haven't used that before and was thinking this was the same as
the inc_return().
-- Steve
prev parent reply other threads:[~2024-08-07 13:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-05 5:59 [PATCH RESEND] tracing: Fix overflow in get_free_elt() Tze-nan Wu
2024-08-06 19:40 ` Steven Rostedt
2024-08-07 11:34 ` Tze-nan Wu (吳澤南)
2024-08-07 13:29 ` Steven Rostedt [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=20240807092936.1661ce6a@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=Cheng-Jui.Wang@mediatek.com \
--cc=Tze-nan.Wu@mediatek.com \
--cc=bobule.chang@mediatek.com \
--cc=eric-yc.wu@mediatek.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=wsd_upstream@mediatek.com \
--cc=zanussi@kernel.org \
/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