Re: [PATCH] sd: close hole in > 2T device rejection when !CONFIG_LBDAF

2017-04-04 Thread Bart Van Assche
On Tue, 2017-04-04 at 19:35 -0400, Martin K. Petersen wrote: > diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c > index fb9b4d29af0b..6084c415c070 100644 > --- a/drivers/scsi/sd.c > +++ b/drivers/scsi/sd.c > @@ -2102,6 +2102,16 @@ static void read_capacity_error(struct scsi_disk > *sdkp, struct

Re: [PATCH] sd: close hole in > 2T device rejection when !CONFIG_LBDAF

2017-04-04 Thread Martin K. Petersen
Bart Van Assche writes: Hi Bart, > Sorry but I still don't understand why the two checks are > different. How about the (untested) patch below? The approach below > avoids that the check is duplicated and - at least in my opinion - > results in code that is easier to

Re: [PATCH] sd: close hole in > 2T device rejection when !CONFIG_LBDAF

2017-02-28 Thread Steve Magnani
On 02/27/2017 12:57 PM, Bart Van Assche wrote: ... How about the (untested) patch below? The approach below avoids that the check is duplicated and - at least in my opinion - results in code that is easier to read. I find lba_too_large() a little dense, but functionally OK. The "shift >= 0"

Re: [PATCH] sd: close hole in > 2T device rejection when !CONFIG_LBDAF

2017-02-27 Thread Martin K. Petersen
> "Bart" == Bart Van Assche writes: Bart, Bart> Sorry but I still don't understand why the two checks are Bart> different. How about the (untested) patch below? The approach Bart> below avoids that the check is duplicated and - at least in my Bart> opinion -

Re: [PATCH] sd: close hole in > 2T device rejection when !CONFIG_LBDAF

2017-02-27 Thread Bart Van Assche
On Mon, 2017-02-27 at 11:13 -0600, Steve Magnani wrote: > On 02/27/2017 10:13 AM, Bart Van Assche wrote: > > Why are the two checks slightly different? Could the same code be used for > > both checks? > > The checks are different because with READ CAPACITY(16) a _really_ huge > device could

Re: [PATCH] sd: close hole in > 2T device rejection when !CONFIG_LBDAF

2017-02-27 Thread Steve Magnani
Hi Bart - Thanks for taking the time to look this over. On 02/27/2017 10:13 AM, Bart Van Assche wrote: On Mon, 2017-02-27 at 09:22 -0600, Steven J. Magnani wrote: @@ -2122,7 +2122,10 @@ static int read_capacity_16(struct scsi_ return -ENODEV; } - if

Re: [PATCH] sd: close hole in > 2T device rejection when !CONFIG_LBDAF

2017-02-27 Thread Bart Van Assche
On Mon, 2017-02-27 at 09:22 -0600, Steven J. Magnani wrote: > @@ -2122,7 +2122,10 @@ static int read_capacity_16(struct scsi_ > return -ENODEV; > } > > - if ((sizeof(sdkp->capacity) == 4) && (lba >= 0xULL)) { > + /* Make sure logical_to_sectors() won't

[PATCH] sd: close hole in > 2T device rejection when !CONFIG_LBDAF

2017-02-27 Thread Steven J. Magnani
When the kernel is compiled _without_ support for large (>= 2TiB) block devices, code in the sd driver's read_capacity() routines rejects devices whose count of native-sized blocks does not fit in the 32 bit sector_t type. A device reporting 4294967296 512-byte blocks will be rejected, but a