From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
To: Kees Cook <kees@kernel.org>, Matthew Wilcox <willy@infradead.org>
Cc: Vlastimil Babka <vbabka@suse.cz>,
Andrew Morton <akpm@linux-foundation.org>,
Christoph Lameter <cl@gentwo.org>,
David Rientjes <rientjes@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
Harry Yoo <harry.yoo@oracle.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH] slab: Saturate to SIZE_MAX for allocation size overflows
Date: Thu, 26 Feb 2026 11:02:43 +0100 [thread overview]
Message-ID: <751a94a7-d5b2-415e-9591-a7d97b452d81@kernel.org> (raw)
In-Reply-To: <202602242315.C9D5430C7@keescook>
On 2/25/26 08:15, Kees Cook wrote:
> On Wed, Feb 25, 2026 at 03:59:08AM +0000, Matthew Wilcox wrote:
>> On Tue, Feb 24, 2026 at 05:40:02PM -0800, Kees Cook wrote:
>> > +++ b/include/linux/slab.h
>> > @@ -1105,7 +1105,7 @@ static inline __alloc_size(1, 2) void *kmalloc_array_noprof(size_t n, size_t siz
>> > size_t bytes;
>> >
>> > if (unlikely(check_mul_overflow(n, size, &bytes)))
>> > - return NULL;
>> > + bytes = SIZE_MAX;
>> > return kmalloc_noprof(bytes, flags);
>>
>> Wouldn't this be better written as:
>>
>> return kmalloc_noprof(size_mul(n, size), flags);
>>
>> (etc)
>
> Sure, I can convert them all that way if that's preferred?
Yeah I think it's better than effectively open-code the same thing?
prev parent reply other threads:[~2026-02-26 10:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 1:40 Kees Cook
2026-02-25 2:36 ` Harry Yoo
2026-02-25 3:59 ` Matthew Wilcox
2026-02-25 7:15 ` Kees Cook
2026-02-26 10:02 ` Vlastimil Babka (SUSE) [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=751a94a7-d5b2-415e-9591-a7d97b452d81@kernel.org \
--to=vbabka@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=cl@gentwo.org \
--cc=harry.yoo@oracle.com \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=vbabka@suse.cz \
--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