lkml.org 
[lkml]   [2019]   [Jun]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v7 5/6] usb:cdns3 Add Cadence USB3 DRD Driver
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

\
 
 \ /
  Last update: 2019-06-11 10:54    [W:0.074 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site