Re: [PATCH v4 1/3] Documentation: adopt new coding style of type-aware kmalloc-family

Manuel Ebner
2026-05-01T09:12:36Z

On Wed, 2026-04-29 at 18:00 -0700, SeongJae Park wrote:
> On Wed, 29 Apr 2026 17:53:36 -0700 SeongJae Park <sj@kernel.org> wrote:
>
> > On Wed, 29 Apr 2026 09:14:44 +0200 Manuel Ebner <manuelebner@mailbox.org>
> > wrote:
> >
> > > Update the documentation to reflect new type-aware kmalloc-family as
> > > suggested in commit 2932ba8d9c99 ("slab: Introduce kmalloc_obj()
> > > and family")
> > >
> > > ptr = kmalloc(sizeof(*ptr), gfp);
> > >  -> ptr = kmalloc_obj(*ptr);
> > > ptr = kmalloc(sizeof(struct some_obj_name), gfp);
> > >  -> ptr = kmalloc_obj(*ptr);
> > > ptr = kzalloc(sizeof(*ptr), gfp);
> > >  -> ptr = kzalloc_obj(*ptr);
> > > ptr = kmalloc_array(count, sizeof(*ptr), gfp);
> > >  -> ptr = kmalloc_objs(*ptr, count);
> > > ptr = kcalloc(count, sizeof(*ptr), gfp);
> > >  -> ptr = kzalloc_objs(*ptr, count);
>
> Forgot asking this, sorry.  Shouldn't 'gfp' parameters be kept?

Yes, i should have kept it, like so:

eg. ptr = kmalloc_obj(*ptr, gfp);
-> ptr = kmalloc_obj(*ptr [, gfp] );

same in [Patch 2/3]

> >

> > > Signed-off-by: Manuel Ebner <manuelebner@mailbox.org>
> >
> > Acked-by: SeongJae Park <sj@kernel.org>
>
> My Acked-by: is still valid regardless of your answer to my trivial question.

Thanks
Manuel

>
> Thanks,
> SJ
>
> …