Re: [PATCH 04/13] vfio/mdev: simplify mdev_type handling

Christoph Hellwig
2022-07-04T06:18:50Z

On Wed, Jun 29, 2022 at 09:17:09AM -0300, Jason Gunthorpe wrote:
> On Tue, Jun 28, 2022 at 03:59:15PM -0600, Alex Williamson wrote:
> > > + strcpy(matrix_dev->mdev_type.sysfs_name, VFIO_AP_MDEV_TYPE_HWVIRT);
> >
> > And then this might as well be an snprintf() as well too.
>
> Kees has setup FORTIFY so the above will actually throw a compile
> warning in build bots if the array size is too small. Changing it to
> snprintf would loose this and cause undetected string truncation.

I think I have an idea how to do away with these arrays entirely,
and just use pointers to sting literals.