On Thu, Apr 9, 2026 at 9:29 AM Andi Shyti <[email protected]> wrote:
>
> Hi Rosen,
>
> along with Luca's comments, I will ask you for one more change:
>
> ...
>
> >       /* Protects aliases and use_mask */
> >       spinlock_t lock;
> > -     u16 *aliases;
> >       unsigned long *use_mask;
> > +     u16 aliases[] __counted_by(size);
>
> ...
>
> > -     alias_pool = kzalloc_obj(*alias_pool);
> > +     alias_pool = kzalloc_flex(*alias_pool, aliases, num_aliases);
> >       if (!alias_pool)
> >               return ERR_PTR(-ENOMEM);
> >
> >       alias_pool->size = num_aliases;
>
> this line is not needed anymore because kzalloc_flex will resolve
> to alias_pool size and will set it tu num_aliases.
I believe that only works with GCC15 and above.
>
> We can remove it.
>
> Thanks,
> Andi
>
> > -     alias_pool->aliases = kcalloc(num_aliases, 
> > sizeof(*alias_pool->aliases), GFP_KERNEL);
> > -     if (!alias_pool->aliases) {
> > -             ret = -ENOMEM;
> > -             goto err_free_alias_pool;
> > -     }
> > -

Reply via email to