Re: [PATCH 1/3] driver core: add a faux bus for use when a simple device/bus is needed

From: Andy Shevchenko
Date: Mon Feb 03 2025 - 11:06:13 EST


On Mon, Feb 03, 2025 at 04:46:56PM +0100, Greg Kroah-Hartman wrote:
> On Mon, Feb 03, 2025 at 04:35:45PM +0100, Greg Kroah-Hartman wrote:
> > > > + */
> > > > +struct faux_device *__faux_device_create(const char *name,
> > > > + struct faux_driver_ops *faux_ops,
> > > > + struct module *owner)
> > > > +{
> > > > + struct device_driver *drv;
> > > > + struct device *dev;
> > > > + struct faux_object *faux_obj;
> > > > + struct faux_device *faux_dev;
> > > > + int ret;
> > >
> > > > + faux_obj = kzalloc(sizeof(*faux_obj) + strlen(name) + 1, GFP_KERNEL);
> > >
> > > Potential overflow. To avoid one may use struct_size() from overflow.h.
> >
> > Users should not be providing the string here. Again, this comes from
> > platform.c.
>
> Sima just proved me wrong, I'll go check for this now, thanks for
> pointing it out.

Ah, you are welcome!

--
With Best Regards,
Andy Shevchenko