Re: [PATCH 5/5] misc: mlx5ctl: Add umem reg/unreg ioctl

From: Jason Gunthorpe
Date: Wed Oct 18 2023 - 07:52:08 EST


On Wed, Oct 18, 2023 at 11:30:24AM +0200, Arnd Bergmann wrote:

> > +struct mlx5ctl_umem_reg {
> > + __aligned_u64 addr; /* user address */
> > + __aligned_u64 len; /* user buffer length */
> > + __aligned_u64 flags;
> > + __u32 umem_id; /* returned device's umem ID */
> > + __u32 reserved[7];
> > +};
> > +
>
> You have a 'flags' argument that is never accessed and can
> probably be removed. If the intention was to make the ioctl
> extensible for the future, this doesn't work unless you
> ensure that only known flags (i.e. none at this point)
> are set,

Yes, all the reserved fields and flags should be checked for 0 in the
ioctl paths to allow them to be used for something else someday.

> and it's probably a bad idea anyway, compared
> to creating a new ioctl command with new semantics.

This has been done successfully quite often in the kernel.

Thanks,
Jason