Re: [PATCH v3 2/5] lib: Add Sed-opal library

2016-12-21 Thread Christoph Hellwig
On Tue, Dec 20, 2016 at 03:07:46PM -0700, Jon Derrick wrote: > > This pretty much seem to contain the OPAL protocol defintions, so why > > not opal_proto.h? > Since there might eventually be a whole class of opal-like sed > protocols, why does it make more sense to have opal_proto.h instead of >

Re: [PATCH v3 2/5] lib: Add Sed-opal library

2016-12-21 Thread Christoph Hellwig
On Tue, Dec 20, 2016 at 03:07:46PM -0700, Jon Derrick wrote: > > This pretty much seem to contain the OPAL protocol defintions, so why > > not opal_proto.h? > Since there might eventually be a whole class of opal-like sed > protocols, why does it make more sense to have opal_proto.h instead of >

Re: [PATCH v3 2/5] lib: Add Sed-opal library

2016-12-21 Thread Christoph Hellwig
On Tue, Dec 20, 2016 at 02:55:10PM -0700, Scott Bauer wrote: > Do you mean from nvme_ioctl? or from blk_ioctl? It was removed from blk_ioctl > because I must have misinterpreted your comments here: > http://lists.infradead.org/pipermail/linux-nvme/2016-December/007364.html nvme_ioctl, aka the

Re: [PATCH v3 2/5] lib: Add Sed-opal library

2016-12-21 Thread Christoph Hellwig
On Tue, Dec 20, 2016 at 02:55:10PM -0700, Scott Bauer wrote: > Do you mean from nvme_ioctl? or from blk_ioctl? It was removed from blk_ioctl > because I must have misinterpreted your comments here: > http://lists.infradead.org/pipermail/linux-nvme/2016-December/007364.html nvme_ioctl, aka the

Re: [PATCH v3 2/5] lib: Add Sed-opal library

2016-12-20 Thread Jon Derrick
On Mon, Dec 19, 2016 at 11:28:47PM -0800, Christoph Hellwig wrote: [snip] > > + while (cpos < total) { > > + if (!(pos[0] & 0x80)) /* tiny atom */ > > + token_length = response_parse_tiny(iter, pos); > > + else if (!(pos[0] & 0x40)) /* short atom */ > > +

Re: [PATCH v3 2/5] lib: Add Sed-opal library

2016-12-20 Thread Jon Derrick
On Mon, Dec 19, 2016 at 11:28:47PM -0800, Christoph Hellwig wrote: [snip] > > + while (cpos < total) { > > + if (!(pos[0] & 0x80)) /* tiny atom */ > > + token_length = response_parse_tiny(iter, pos); > > + else if (!(pos[0] & 0x40)) /* short atom */ > > +

Re: [PATCH v3 2/5] lib: Add Sed-opal library

2016-12-20 Thread Scott Bauer
> > + > > +int fdev_sed_ioctl(struct file *filep, unsigned int cmd, > > + unsigned long arg) > > +{ > > + struct sed_key key; > > + struct sed_context *sed_ctx; > > + > > + if (!capable(CAP_SYS_ADMIN)) > > + return -EACCES; > > + > > + if (!filep->f_sedctx ||

Re: [PATCH v3 2/5] lib: Add Sed-opal library

2016-12-20 Thread Scott Bauer
> > + > > +int fdev_sed_ioctl(struct file *filep, unsigned int cmd, > > + unsigned long arg) > > +{ > > + struct sed_key key; > > + struct sed_context *sed_ctx; > > + > > + if (!capable(CAP_SYS_ADMIN)) > > + return -EACCES; > > + > > + if (!filep->f_sedctx ||

Re: [PATCH v3 2/5] lib: Add Sed-opal library

2016-12-19 Thread Christoph Hellwig
> + u8 lr; > + size_t key_name_len; > + char key_name[36]; Who is going to use the key_name? I can't find another reference to it anywhere else in the code. The reason why this tripped me off was the hardcoded length so I was going to check on how access to it is bounds checked. >

Re: [PATCH v3 2/5] lib: Add Sed-opal library

2016-12-19 Thread Christoph Hellwig
> + u8 lr; > + size_t key_name_len; > + char key_name[36]; Who is going to use the key_name? I can't find another reference to it anywhere else in the code. The reason why this tripped me off was the hardcoded length so I was going to check on how access to it is bounds checked. >

Re: [PATCH v3 2/5] lib: Add Sed-opal library

2016-12-19 Thread Al Viro
On Mon, Dec 19, 2016 at 12:35:46PM -0700, Scott Bauer wrote: > +int fdev_sed_ioctl(struct file *filep, unsigned int cmd, > +unsigned long arg) > +{ > + struct sed_key key; > + struct sed_context *sed_ctx; > + > + if (!capable(CAP_SYS_ADMIN)) > + return

Re: [PATCH v3 2/5] lib: Add Sed-opal library

2016-12-19 Thread Al Viro
On Mon, Dec 19, 2016 at 12:35:46PM -0700, Scott Bauer wrote: > +int fdev_sed_ioctl(struct file *filep, unsigned int cmd, > +unsigned long arg) > +{ > + struct sed_key key; > + struct sed_context *sed_ctx; > + > + if (!capable(CAP_SYS_ADMIN)) > + return

Re: [PATCH v3 2/5] lib: Add Sed-opal library

2016-12-19 Thread Christoph Hellwig
On Mon, Dec 19, 2016 at 04:34:15PM -0500, Keith Busch wrote: > This seems like an optional library that some environments may wish to > opt-out of building into the kernel. Any reason not to add an entry into > the Kconfig to turn this on/off? This needs to be a CONFIG_BLOCK_SED /

Re: [PATCH v3 2/5] lib: Add Sed-opal library

2016-12-19 Thread Christoph Hellwig
On Mon, Dec 19, 2016 at 04:34:15PM -0500, Keith Busch wrote: > This seems like an optional library that some environments may wish to > opt-out of building into the kernel. Any reason not to add an entry into > the Kconfig to turn this on/off? This needs to be a CONFIG_BLOCK_SED /

Re: [PATCH v3 2/5] lib: Add Sed-opal library

2016-12-19 Thread kbuild test robot
Hi Scott, [auto build test WARNING on linus/master] [also build test WARNING on v4.9 next-20161219] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url:

Re: [PATCH v3 2/5] lib: Add Sed-opal library

2016-12-19 Thread kbuild test robot
Hi Scott, [auto build test WARNING on linus/master] [also build test WARNING on v4.9 next-20161219] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url:

Re: [PATCH v3 2/5] lib: Add Sed-opal library

2016-12-19 Thread kbuild test robot
Hi Scott, [auto build test ERROR on linus/master] [also build test ERROR on v4.9 next-20161219] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url:

Re: [PATCH v3 2/5] lib: Add Sed-opal library

2016-12-19 Thread kbuild test robot
Hi Scott, [auto build test ERROR on linus/master] [also build test ERROR on v4.9 next-20161219] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url:

Re: [PATCH v3 2/5] lib: Add Sed-opal library

2016-12-19 Thread Keith Busch
On Mon, Dec 19, 2016 at 12:35:46PM -0700, Scott Bauer wrote: > This patch implements the necessary logic to bring an Opal > enabled drive out of a factory-enabled into a working > Opal state. > > This patch set also enables logic to save a password to > be replayed during a resume from suspend. >

Re: [PATCH v3 2/5] lib: Add Sed-opal library

2016-12-19 Thread Keith Busch
On Mon, Dec 19, 2016 at 12:35:46PM -0700, Scott Bauer wrote: > This patch implements the necessary logic to bring an Opal > enabled drive out of a factory-enabled into a working > Opal state. > > This patch set also enables logic to save a password to > be replayed during a resume from suspend. >

[PATCH v3 2/5] lib: Add Sed-opal library

2016-12-19 Thread Scott Bauer
This patch implements the necessary logic to bring an Opal enabled drive out of a factory-enabled into a working Opal state. This patch set also enables logic to save a password to be replayed during a resume from suspend. Signed-off-by: Scott Bauer Signed-off-by: Rafael

[PATCH v3 2/5] lib: Add Sed-opal library

2016-12-19 Thread Scott Bauer
This patch implements the necessary logic to bring an Opal enabled drive out of a factory-enabled into a working Opal state. This patch set also enables logic to save a password to be replayed during a resume from suspend. Signed-off-by: Scott Bauer Signed-off-by: Rafael Antognolli ---