linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v2 1/3] Documentation: adopt new coding style of type-aware kmalloc-family
       [not found]   ` <aefPCV4ZvrnrCmoH@casper.infradead.org>
@ 2026-04-21 19:50     ` Manuel Ebner
  0 siblings, 0 replies; only message in thread
From: Manuel Ebner @ 2026-04-21 19:50 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Jonathan Corbet, Shuah Khan, linux-doc, Kees Cook, linux-kernel,
	workflows, linux-sound, linux-media, linux-mm

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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-21 19:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20260421175516.224960-2-manuelebner@mailbox.org>
     [not found] ` <20260421180200.225244-2-manuelebner@mailbox.org>
     [not found]   ` <aefPCV4ZvrnrCmoH@casper.infradead.org>
2026-04-21 19:50     ` [PATCH v2 1/3] Documentation: adopt new coding style of type-aware kmalloc-family Manuel Ebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox