summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorGreg Edwards <gedwards@ddn.com>2018-08-08 22:27:53 +0300
committerJens Axboe <axboe@kernel.dk>2018-08-09 17:25:04 +0300
commitd6c02a9beb67f13d5f14f23e72fa9981e8b84477 (patch)
treecc921bc4fba16e9fc8e072f7d9d112bba6e3162e /block
parent4884f8bf87f6af065b8268b3baf0d16aff95de4a (diff)
downloadlinux-d6c02a9beb67f13d5f14f23e72fa9981e8b84477.tar.xz
block: bvec_nr_vecs() returns value for wrong slab
In commit ed996a52c868 ("block: simplify and cleanup bvec pool handling"), the value of the slab index is incremented by one in bvec_alloc() after the allocation is done to indicate an index value of 0 does not need to be later freed. bvec_nr_vecs() was not updated accordingly, and thus returns the wrong value. Decrement idx before performing the lookup. Fixes: ed996a52c868 ("block: simplify and cleanup bvec pool handling") Signed-off-by: Greg Edwards <gedwards@ddn.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/bio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/bio.c b/block/bio.c
index b832151cd0bf..04969b392c72 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -158,7 +158,7 @@ out:
unsigned int bvec_nr_vecs(unsigned short idx)
{
- return bvec_slabs[idx].nr_vecs;
+ return bvec_slabs[--idx].nr_vecs;
}
void bvec_free(mempool_t *pool, struct bio_vec *bv, unsigned int idx)