[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190611085352.GA27627@kuha.fi.intel.com>
Date: Tue, 11 Jun 2019 11:53:52 +0300
From: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To: Pawel Laszczak <pawell@...ence.com>
Cc: "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"felipe.balbi@...ux.intel.com" <felipe.balbi@...ux.intel.com>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"hdegoede@...hat.com" <hdegoede@...hat.com>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"rogerq@...com" <rogerq@...com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"jbergsagel@...com" <jbergsagel@...com>,
"nsekhar@...com" <nsekhar@...com>, "nm@...com" <nm@...com>,
Suresh Punnoose <sureshp@...ence.com>,
"peter.chen@....com" <peter.chen@....com>,
Jayshri Dajiram Pawar <jpawar@...ence.com>,
Rahul Kumar <kurahul@...ence.com>
Subject: Re: [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
Powered by blists - more mailing lists