mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Manuel Ebner <manuelebnerli@mailbox.org>
To: arina.kharlamova@mbzuai.ac.ae, Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan	 <skhan@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Kees Cook	 <kees@kernel.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	Vlastimil Babka <vbabka@kernel.org>, Harry Yoo <harry@kernel.org>,
	Hao Li <hao.li@linux.dev>,  Christoph Lameter	 <cl@gentwo.org>,
	David Rientjes <rientjes@google.com>,
	Roman Gushchin	 <roman.gushchin@linux.dev>
Cc: workflows@vger.kernel.org, linux-doc@vger.kernel.org,
	 linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org,
	 linux-mm@kvack.org
Subject: Re: [PATCH v2] slab: fix the kernel-doc of kmalloc_flex() on counter overflow
Date: Sun, 29 Nov 2026 08:40:44 +0100	[thread overview]
Message-ID: <64a9e601da9b44bd8f8b141023c5b214b89cc34e.camel@mailbox.org> (raw)
In-Reply-To: <20261129-slab-doc-v2-1-666aeac2fcc3@mbzuai.ac.ae>

Hi Arina,

On Sun, 2026-11-29 at 10:04 +0400, Arina Kharlamova via B4 Relay wrote:
> From: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
> 
> Commit fa5c82f4d2bb ("slab.h: disable completely broken overflow handling
> in flex allocations") removed the counter overflow check from
> __alloc_flex(), but the kernel-doc and deprecated.rst still say that the
> allocation fails if COUNT does not fit in the __counted_by() counter.
> 
> Update them to match the code. While at it, fix the Returns: line of
> overflows_flex_counter_type(), where true and false are swapped.
> 
> Fixes: fa5c82f4d2bb ("slab.h: disable completely broken overflow handling in flex allocations")
> Signed-off-by: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
> ---
> Found by checks derived from the spec2patch kernel API specifications,
> with the help of an AI coding assistant (Claude); I reviewed the
> analysis and the fix.
> ---
> Changes in v2:
> - Shorten the changelog and the comments (Harry Yoo)
> - Rebase on slab/for-next
> - Link to v1: https://patch.msgid.link/20261124-slab-doc-v1-1-9f14dfce47c8@mbzuai.ac.ae
> ---
>  Documentation/process/deprecated.rst |  7 +++----
>  include/linux/overflow.h             |  5 +++--
>  include/linux/slab.h                 | 10 ++++------
>  3 files changed, 10 insertions(+), 12 deletions(-)
> 
> diff --git a/Documentation/process/deprecated.rst b/Documentation/process/deprecated.rst
> index 22a5e62c92ea..ea392cf36fb8 100644
> --- a/Documentation/process/deprecated.rst
> +++ b/Documentation/process/deprecated.rst
> @@ -405,7 +405,6 @@ become, respectively::
>  	__auto_type ptr = kmalloc_obj(struct foo [, gfp] );
>  
>  The argument gfp is optional, the default value is GFP_KERNEL.

could you add this diff in you patch?
https://lore.kernel.org/all/20260909141255.1367539-2-manuelebnerli@mailbox.org/

Else looks good to me.
Reviewed-by: Manuel Ebner <manuelebnerli@mailbox.org>

Thanks
 Manuel

> -If `ptr->flex_member` is annotated with __counted_by(), the allocation
> -will automatically fail if `count` is larger than the maximum
> -representable value that can be stored in the counter member associated
> -with `flex_member`.
> +If `ptr->flex_member` is annotated with __counted_by(), the caller must
> +make sure that `count` fits in the counter member associated with
> +`flex_member`.
> diff --git a/include/linux/overflow.h b/include/linux/overflow.h
> 
> [...]
> 
> Best regards,
> --  
> Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
> 

      reply	other threads:[~2026-11-29  7:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29  6:04 Arina Kharlamova via B4 Relay
2026-11-29  7:40 ` Manuel Ebner [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=64a9e601da9b44bd8f8b141023c5b214b89cc34e.camel@mailbox.org \
    --to=manuelebnerli@mailbox.org \
    --cc=arina.kharlamova@mbzuai.ac.ae \
    --cc=cl@gentwo.org \
    --cc=corbet@lwn.net \
    --cc=gustavoars@kernel.org \
    --cc=hao.li@linux.dev \
    --cc=harry@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rdunlap@infradead.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=skhan@linuxfoundation.org \
    --cc=vbabka@kernel.org \
    --cc=workflows@vger.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

all inboxes | Powered by JetHome®