summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWenbo Wang <wenbo.wang@memblaze.com>2015-03-20 01:04:54 -0400
committerJens Axboe <axboe@fb.com>2015-03-30 12:54:58 -0600
commit9dc7acf1f18942fef5d12bc4a2fd52913a86ec2d (patch)
tree51efb4784527b06758fcb2a4e1487da985da3e69
parentac165e5e12e4eac9123d018311c278c974cf9093 (diff)
Fix bug in blk_rq_merge_ok
Use the right array index to reference the last element of rq->biotail->bi_io_vec[] Signed-off-by: Wenbo Wang <wenbo.wang@memblaze.com> Reviewed-by: Chong Yuan <chong.yuan@memblaze.com> Fixes: 66cb45aa41315 ("block: add support for limiting gaps in SG lists") Cc: stable@kernel.org Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--block/blk-merge.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 7dad30f5603f..35939e27af9e 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -551,7 +551,7 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio)
if (q->queue_flags & (1 << QUEUE_FLAG_SG_GAPS)) {
struct bio_vec *bprev;
- bprev = &rq->biotail->bi_io_vec[bio->bi_vcnt - 1];
+ bprev = &rq->biotail->bi_io_vec[rq->biotail->bi_vcnt - 1];
if (bvec_gap_to_prev(bprev, bio->bi_io_vec[0].bv_offset))
return false;
}