Re: [PATCH 04/20] dlb2: add device ioctl layer and first 4 ioctls

Randy Dunlap
2020-07-12T14:55:14Z

On 7/12/20 6:43 AM, Gage Eads wrote:
> +int dlb2_ioctl_dispatcher(struct dlb2_dev *dev,
> + unsigned int cmd,
> + unsigned long arg)
> +{
> + u16 sz = _IOC_SIZE(cmd);
> +
> + if (_IOC_NR(cmd) >= NUM_DLB2_CMD) {

Does this bounds check need to use array_index_nospec()
from <linux/nospec.h> ?

> + dev_err(dev->dlb2_device,
> + "[%s()] Unexpected DLB command %d\n",
> + __func__, _IOC_NR(cmd));
> + return -1;
> + }
> +
> + return dlb2_ioctl_callback_fns[_IOC_NR(cmd)](dev, arg, sz);
> +}

I don't know if it needs to or not. I just want to make sure
that you or someone has thought about it.

--
~Randy