On Mon, Mar 30, 2026 at 8:15 AM Borislav Petkov <[email protected]> wrote:
>
> On Thu, Mar 26, 2026 at 07:48:28PM -0700, Rosen Penev wrote:
> > Convert struct mem_ctl_info to use flex array and use the new flex
> > array helpers to simplify initialization.
>
> Meh, simplify... rather to teach an old dog like me new tricks... :)
>
> > Add __counted_by for extra runtime analysis when requested.
> >
> > Move counting assignment immediately after allocation as required by
> > __counted_by.
>
> So far so good.
>
> > Move memcpy to make it clear that this should have been kmemdup_array.
>
> But you lost me here. What do you mean with the "should have been
> kmemdup_array"?
kzalloc_flex == kzalloc + kcalloc.
kmemdup == kzalloc + memcpy.
kmemdup_array == kcalloc + memcpy.

So all together,
kzalloc + kcalloc + memcpy.

Or

kzalloc_flex + memcpy.

Placing the memcpy right after counting variable assignment enables
coccinelle to transform this whole thing into a single

kmemdup_flex

call if such a thing were to eventually be introduced.
>
> Thx.
>
> --
> Regards/Gruss,
>     Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette

Reply via email to