Skip to contentSkip to conversation

bsg: Remove bogus check against request_queue->max_sectors

PATCH Superseded Boaz Harrosh 3 participants 3 messages Jan 20, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bsg: Remove bogus check against request_queue->max_sectors

bsg submits REQ_TYPE_BLOCK_PC so the right check is max_hw_sectors. But I've removed this check because right after, bsg proceeds with calling blk_rq_map_user() which does all the right checks.

---
 block/bsg.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
block/bsg.c +0 -3
index 0ce8806..44a2a0f 100644
@@ -218,9 +218,6 @@ bsg_validate_sgv4_hdr(struct request_queue *q, struct sg_io_v4 *hdr, int *rw)
 
 	if (hdr->guard != 'Q')
 		return -EINVAL;
-	if (hdr->dout_xfer_len > (q->max_sectors << 9) ||
-	    hdr->din_xfer_len > (q->max_sectors << 9))
-		return -EIO;
 
 	switch (hdr->protocol) {
 	case BSG_PROTOCOL_SCSI:
Signature · 1 line
1.6.0.1
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Boaz Harrosh

bsg submits REQ_TYPE_BLOCK_PC so the right check is max_hw_sectors. But I've removed this check because right after, bsg proceeds with calling blk_rq_map_user() which does all the right checks.

Definitely right.

Quoted 21 lines
---
 block/bsg.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
block/bsg.c +0 -3
index 0ce8806..44a2a0f 100644
@@ -218,9 +218,6 @@ bsg_validate_sgv4_hdr(struct request_queue *q, struct sg_io_v4 *hdr, int *rw)
 
 	if (hdr->guard != 'Q')
 		return -EINVAL;
-	if (hdr->dout_xfer_len > (q->max_sectors << 9) ||
-	    hdr->din_xfer_len > (q->max_sectors << 9))
-		return -EIO;
 
 	switch (hdr->protocol) {
 	case BSG_PROTOCOL_SCSI:
Signature · 1 line
1.6.0.1
Signature · 1 line
Jens Axboe
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Boaz Harrosh
Quoted 15 lines · On Tue, 20 Jan 2009 15:08:22 +0200 Boaz Harrosh <[email protected]> wrote:

bsg submits REQ_TYPE_BLOCK_PC so the right check is max_hw_sectors. But I've removed this check because right after, bsg proceeds with calling blk_rq_map_user() which does all the right checks.

---
 block/bsg.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
block/bsg.c +0 -0
index 0ce8806..44a2a0f 100644

block/bsg.c bsg_validate_sgv4_hdr(struct request_queue *q, struct sg_io_v4 *hdr, int *rw) · line 223

Quoted 9 lines
block/bsg.c +0 -3
@@ -218,9 +218,6 @@ bsg_validate_sgv4_hdr(struct request_queue *q, struct sg_io_v4 *hdr, int *rw)
 
 	if (hdr->guard != 'Q')
 		return -EINVAL;
-	if (hdr->dout_xfer_len > (q->max_sectors << 9) ||
-	    hdr->din_xfer_len > (q->max_sectors << 9))
-		return -EIO;
 
 	switch (hdr->protocol) {
 	case BSG_PROTOCOL_SCSI:

Thanks,