From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Huiwen He <hehuiwen@kylinos.cn>,
markus.elfring@web.de, aliceryhl@google.com,
andrewjballance@gmail.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, maple-tree@lists.infradead.org
Subject: Re: [PATCH] maple_tree: Fix potential NULL pointer dereference if mas_pop_node() fails
Date: Tue, 21 Oct 2025 10:19:12 -0400 [thread overview]
Message-ID: <yc7zi3u4766orj7k7czsjxpaykuwbcehhcgler4vixkfzxjgke@yqlywdfalbu4> (raw)
In-Reply-To: <aPVGqRKFcI1SjZdk@casper.infradead.org>
* Matthew Wilcox <willy@infradead.org> [251019 16:14]:
> On Sun, Oct 19, 2025 at 07:49:16PM +0800, Huiwen He wrote:
...
>
> Do not send a v2 until somebody has a substantive comment. I suspect
> that what you are doing here is wrong, but I lack the understanding to
> explain why it is wrong.
Thanks Matthew.
This is not necessary.
At this point we ALWAYS have enough allocations.
I'm guessing you saw the WARN_ON() and return of NULL and assumed we'd
need to check the return in caller. This WARN_ON() is in place in case
the calculations are incorrect in some corner case (which has never
happened in mainline), so this will add extra instructions for a
significant amount of calls, especially the mas_wr_node_store() path,
with no chance of catching an error.
In fact, the only time I've seen the tree fail to allocate enough memory
is when syzbot fails allocations - and that will happen in the
preallocation stage, which does check the return.
So, thanks for looking but this patch is unnecessary.
Thanks,
Liam
prev parent reply other threads:[~2025-10-21 14:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-18 15:23 Huiwen He
2025-10-18 16:38 ` Markus Elfring
2025-10-19 0:32 ` Matthew Wilcox
2025-10-19 11:49 ` Huiwen He
2025-10-19 20:14 ` Matthew Wilcox
2025-10-21 14:19 ` Liam R. Howlett [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=yc7zi3u4766orj7k7czsjxpaykuwbcehhcgler4vixkfzxjgke@yqlywdfalbu4 \
--to=liam.howlett@oracle.com \
--cc=aliceryhl@google.com \
--cc=andrewjballance@gmail.com \
--cc=hehuiwen@kylinos.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=maple-tree@lists.infradead.org \
--cc=markus.elfring@web.de \
--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