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

2020-08-05 Thread gregkh
Topel, Bjorn > > > > Subject: Re: [PATCH 04/20] dlb2: add device ioctl layer and first 4 ioctls > > > > On Tue, Aug 04, 2020 at 10:20:47PM +, Eads, Gage wrote: > > > > > +/* [7:0]: device revision, [15:8]: device version */ > > > > > +#d

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

2020-08-05 Thread Eads, Gage
> -Original Message- > From: gregkh > Sent: Wednesday, August 5, 2020 10:18 AM > To: Eads, Gage > Cc: Arnd Bergmann ; linux-kernel@vger.kernel.org; > Karlsson, Magnus ; Topel, Bjorn > > Subject: Re: [PATCH 04/20] dlb2: add device ioctl layer and first 4 io

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

2020-08-05 Thread Eads, Gage
> -Original Message- > From: gregkh > Sent: Wednesday, August 5, 2020 1:46 AM > To: Eads, Gage > Cc: Arnd Bergmann ; linux-kernel@vger.kernel.org; > Karlsson, Magnus ; Topel, Bjorn > > Subject: Re: [PATCH 04/20] dlb2: add device ioctl layer and first 4 io

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

2020-08-04 Thread gregkh
On Tue, Aug 04, 2020 at 10:20:47PM +, Eads, Gage wrote: > > > +/* [7:0]: device revision, [15:8]: device version */ > > > +#define DLB2_SET_DEVICE_VERSION(ver, rev) (((ver) << 8) | (rev)) > > > + > > > +static int dlb2_ioctl_get_device_version(struct dlb2_dev *dev, > > > +

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

2020-08-04 Thread Eads, Gage
> > +/* [7:0]: device revision, [15:8]: device version */ > > +#define DLB2_SET_DEVICE_VERSION(ver, rev) (((ver) << 8) | (rev)) > > + > > +static int dlb2_ioctl_get_device_version(struct dlb2_dev *dev, > > +unsigned long user_arg, > > +

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

2020-07-17 Thread gregkh
pel, Bjorn > > > > Subject: Re: [PATCH 04/20] dlb2: add device ioctl layer and first 4 ioctls > > > > On Fri, Jul 17, 2020 at 8:19 PM Eads, Gage wrote: > > > > > > A plain copy_from_user() in place of this function should be fine. > > > > &g

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

2020-07-17 Thread Eads, Gage
> -Original Message- > From: Arnd Bergmann > Sent: Friday, July 17, 2020 1:57 PM > To: Eads, Gage > Cc: linux-kernel@vger.kernel.org; gregkh ; > Karlsson, Magnus ; Topel, Bjorn > > Subject: Re: [PATCH 04/20] dlb2: add device ioctl layer and first 4 ioctls >

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

2020-07-17 Thread Arnd Bergmann
On Fri, Jul 17, 2020 at 8:19 PM Eads, Gage wrote: > > A plain copy_from_user() in place of this function should be fine. > > This function also validates the user size arg to prevent buffer overflow; > centralizing it here avoids the case where a programmer accidentally forgets > the check in a

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

2020-07-17 Thread Eads, Gage
> -Original Message- > From: Randy Dunlap > Sent: Sunday, July 12, 2020 9:42 AM > To: Eads, Gage ; linux-kernel@vger.kernel.org; > a...@arndb.de; gre...@linuxfoundation.org > Cc: Karlsson, Magnus ; Topel, Bjorn > > Subject: Re: [PATCH 04/20] dlb2: add device

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

2020-07-17 Thread Eads, Gage
> -Original Message- > From: Randy Dunlap > Sent: Sunday, July 12, 2020 9:54 AM > To: Eads, Gage ; linux-kernel@vger.kernel.org; > a...@arndb.de; gre...@linuxfoundation.org > Cc: Karlsson, Magnus ; Topel, Bjorn > > Subject: Re: [PATCH 04/20] dlb2: add device

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

2020-07-17 Thread Eads, Gage
> > +/* Verify the ioctl argument size and copy the argument into kernel > > +memory */ static int dlb2_copy_from_user(struct dlb2_dev *dev, > > + unsigned long user_arg, > > + u16 user_size, > > + void *arg, >

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

2020-07-12 Thread Arnd Bergmann
On Sun, Jul 12, 2020 at 3:46 PM Gage Eads wrote: > > This commit introduces the dlb2 device ioctl layer, and the first four > ioctls: query device version, driver version, and available resources; and > create a scheduling domain. This commit also introduces the user-space > interface file dlb2_us

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

2020-07-12 Thread Randy Dunlap
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

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

2020-07-12 Thread Randy Dunlap
On 7/12/20 6:43 AM, Gage Eads wrote: > +// > +/* dlb2 ioctl codes */ > +// > + > +#define DLB2_IOC_MAGIC 'h' Hi, This magic value should be documented in Documentation/userspace-api/ioctl/ioctl-number.rst. thanks. -- ~Randy

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

2020-07-12 Thread Gage Eads
This commit introduces the dlb2 device ioctl layer, and the first four ioctls: query device version, driver version, and available resources; and create a scheduling domain. This commit also introduces the user-space interface file dlb2_user.h. The PF hardware operation for scheduling domain creat