From: SeongJae Park <sj@kernel.org>
To: "Liam R. Howlett" <liam@infradead.org>
Cc: SeongJae Park <sj@kernel.org>, Alice Ryhl <aliceryhl@google.com>,
Steven Rostedt <rostedt@goodmis.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-mm@kvack.org, Andrew Ballance <andrewjballance@gmail.com>,
maple-tree@lists.infradead.org,
Andrew Morton <akpm@linux-foundation.org>,
Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH] maple_tree: document that "last" in mtree_insert_range() is inclusive
Date: Fri, 8 May 2026 17:59:46 -0700 [thread overview]
Message-ID: <20260509005947.84550-1-sj@kernel.org> (raw)
In-Reply-To: <d5qyczrzz7yzxpveshdbm2u3fl7p3db73iczjydbm5aghkjkno@t5jf4hgkzpqk>
On Fri, 8 May 2026 22:51:51 +0200 "Liam R. Howlett" <liam@infradead.org> wrote:
> On 26/05/07 06:44AM, Alice Ryhl wrote:
> > On Wed, May 06, 2026 at 10:52:18AM -0400, Steven Rostedt wrote:
> > > From: Steven Rostedt <rostedt@goodmis.org>
> > >
> > > The kernel doc of mtree_insert_range() does not state if the address
> > > represented by the "last" parameter is inclusive or exclusive. This can
> > > lead to bugs by code that assumes it is exclusive. Explicitly state that
> > > the parameter is inclusive, and add '[' and ']' around the word "end" to
> > > also stress this point.
> > >
> > > Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> >
> > Reviewed-by: Alice Ryhl <aliceryhl@google.com>
> >
> > > lib/maple_tree.c | 4 +++-
> > > 1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> > > index 60ae5e6fc1ee..dc9591218446 100644
> > > --- a/lib/maple_tree.c
> > > +++ b/lib/maple_tree.c
> > > @@ -5730,10 +5730,12 @@ EXPORT_SYMBOL(mtree_store);
> > > * mtree_insert_range() - Insert an entry at a given range if there is no value.
> > > * @mt: The maple tree
> > > * @first: The start of the range
> > > - * @last: The end of the range
> > > + * @last: The [end] of the range
> > > * @entry: The entry to store
> > > * @gfp: The GFP_FLAGS to use for allocations.
> > > *
> > > + * Note that @last is inclusive. That is, @last = @first + length - 1;
> >
> > How about writing it like this?
> >
> > * @first: The start of the range
> > * @last: The end of the range (inclusive)
>
>
> I like this.
+1. I'm also wondering if it make sense to add '(inclusive)' for 'first', too.
>
> I think the range should be identified in the initial statement.
> Something like this:
>
> mtree_insert_range() - Insert an entry from [first, last] if there isn't
> an entry within that range.
+1.
Thanks,
SJ
[...]
next prev parent reply other threads:[~2026-05-09 1:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 14:52 [PATCH] maple_tree: document that "last" in mtree_insert_range() is inclusive Steven Rostedt
2026-05-07 6:44 ` Alice Ryhl
2026-05-08 20:51 ` Liam R. Howlett
2026-05-09 0:59 ` SeongJae Park [this message]
2026-05-09 8:31 ` Matthew Wilcox
2026-05-09 15:38 ` SeongJae Park
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=20260509005947.84550-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=aliceryhl@google.com \
--cc=andrewjballance@gmail.com \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=maple-tree@lists.infradead.org \
--cc=rostedt@goodmis.org \
--cc=willy@infradead.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