On Thu, Mar 26, 2026 at 1:22 AM Marc Kleine-Budde <[email protected]> wrote:
>
> On 25.03.2026 21:47:25, Rosen Penev wrote:
> > Use the proper function to allocate a struct with a flexible array
> > member.
> >
> > Add __counted_by for extra runtime analysis. Add counting variable
> > assignment as required by __counted_by.
> >
> > Signed-off-by: Rosen Penev <[email protected]>
>
> NACK - What's you motivation to do this?
>
> > ---
> > drivers/siox/siox-core.c | 5 +++--
> > drivers/siox/siox.h | 3 ++-
> > 2 files changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/siox/siox-core.c b/drivers/siox/siox-core.c
> > index 3e8f3b6a4555..b87e2a12d640 100644
> > --- a/drivers/siox/siox-core.c
> > +++ b/drivers/siox/siox-core.c
> > @@ -689,10 +689,11 @@ struct siox_master *siox_master_alloc(struct device
> > *dev,
> > if (!dev)
> > return NULL;
> >
> > - smaster = kzalloc(sizeof(*smaster) + size, GFP_KERNEL);
> > + smaster = kzalloc_flex(*smaster, buf, size);
> > if (!smaster)
> > return NULL;
> >
> > + smaster->buf_len = size;
>
> The "size" extra space is not used for master->buf, but for
> dev->driver_data. master->buf is allocated in siox_device_add().
I assume this means a new struct member should be added and
kzalloc_flex modified to work on that.
>
> regards,
> Marc
>
> --
> Pengutronix e.K. | Marc Kleine-Budde |
> Embedded Linux | https://www.pengutronix.de |
> Vertretung Nürnberg | Phone: +49-5121-206917-129 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |