linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Manuel Ebner <manuelebner@mailbox.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	 linux-doc@vger.kernel.org, Kees Cook <kees@kernel.org>,
	 linux-kernel@vger.kernel.org, workflows@vger.kernel.org,
	 linux-sound@vger.kernel.org, linux-media@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [PATCH v2 1/3] Documentation: adopt new coding style of type-aware kmalloc-family
Date: Tue, 21 Apr 2026 21:50:34 +0200	[thread overview]
Message-ID: <f1bf7387d578ce4d52ad3830a5c9d9e4ceb86b62.camel@mailbox.org> (raw)
In-Reply-To: <aefPCV4ZvrnrCmoH@casper.infradead.org>

On Tue, 2026-04-21 at 20:24 +0100, Matthew Wilcox wrote:
> On Tue, Apr 21, 2026 at 08:01:58PM +0200, Manuel Ebner wrote:
> > +++ b/Documentation/core-api/memory-allocation.rst
> > @@ -135,7 +135,7 @@ Selecting memory allocator
> >  The most straightforward way to allocate memory is to use a function
> >  from the kmalloc() family. And, to be on the safe side it's best to use
> >  routines that set memory to zero, like kzalloc(). If you need to
> > -allocate memory for an array, there are kmalloc_array() and kcalloc()
> > +allocate memory for an array, there are kmalloc_objs() and kzalloc_objs()
> >  helpers. The helpers struct_size(), array_size() and array3_size() can
> >  be used to safely calculate object sizes without overflowing.
> 
> This seems to have been done without any thought.  kmalloc_array() still
> exists and has over 500 callers.  It should not be de-documented.

you are right

> > @@ -151,7 +151,7 @@ sizes, the alignment is guaranteed to be at least the
> > largest power-of-two
> >  divisor of the size.
> >  
> >  Chunks allocated with kmalloc() can be resized with krealloc(). Similarly
> > -to kmalloc_array(): a helper for resizing arrays is provided in the form of
> > +to kmalloc_objs(): a helper for resizing arrays is provided in the form of
> >  krealloc_array().
> 
> Think about why this is wrong too.

i see now.

> And you should have cc'd linux-mm on this.

will add in [v3]

thanks,

manuel



           reply	other threads:[~2026-04-21 19:50 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <aefPCV4ZvrnrCmoH@casper.infradead.org>]

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=f1bf7387d578ce4d52ad3830a5c9d9e4ceb86b62.camel@mailbox.org \
    --to=manuelebner@mailbox.org \
    --cc=corbet@lwn.net \
    --cc=kees@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=willy@infradead.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