> +static int blk_trace_setup2(struct request_queue *q, char *name, dev_t dev,
> + struct block_device *bdev, char __user *arg)
> +{
> + struct blk_user_trace_setup2 buts2;
> + struct blk_trace *bt;
> + int ret;
> +
> + ret = copy_from_user(&buts2, arg, sizeof(buts2));
> + if (ret)
> + return -EFAULT;
You can simplify this to the more usual:
if (copy_from_user(&buts2, arg, sizeof(buts2)))
return -EFAULT;
> +
> + if (!buts2.buf_size || !buts2.buf_nr)
> + return -EINVAL;
This should probably also check that nothing is set in the flags field
so that it can be used for backwards compatible extensions?