Re: [PATCH v7 5/6] usb:cdns3 Add Cadence USB3 DRD Driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Pawel,

On Mon, Jun 10, 2019 at 06:33:29AM +0000, Pawel Laszczak wrote:
> >> +static ssize_t cdns3_mode_write(struct file *file,
> >> +				const char __user *ubuf,
> >> +				size_t count, loff_t *ppos)
> >> +{
> >> +	struct seq_file	 *s = file->private_data;
> >> +	struct cdns3 *cdns = s->private;
> >> +	u32 mode = USB_DR_MODE_UNKNOWN;
> >> +	char buf[32];
> >> +	int ret = 0;
> >
> >        int ret;
> >
> >> +	if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
> >> +		return -EFAULT;
> >
> >                return -EINVAL;
> 
> Why? I've checked in some place in kernel and after copy_from_user are used EFAULT.
> I think that EINVAL is better but I wanted be  consistent with the rest of kernel. 
> 
> Is there any explanation for this ?

No. You are correct. EFAULT seems to be used with copy_from_user().

thanks,

-- 
heikki



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux