]> git.baikalelectronics.ru Git - kernel.git/commit
block: fix the bio_vec array index out-of-bounds test
authorKazuhisa Ichikawa <ki@epsilou.com>
Tue, 12 May 2009 11:27:45 +0000 (13:27 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 12 May 2009 11:27:45 +0000 (13:27 +0200)
commitd1e9a431c85d4f80354ab5f7f8c39ce8a0458238
tree4170275db90f306935e35be1c2cd2cbd6a1a27a8
parentefb6e8939dfad29c83c56806675ce55588eb58ef
block: fix the bio_vec array index out-of-bounds test

Current bio_vec array index out-of-bounds test within
__end_that_request_first() does not seem correct.
It checks bio->bi_idx against bio->bi_vcnt, but the subsequent code
uses idx (which is, bio->bi_idx + next_idx) as the array index into
bio_vec array. This means that the test really make sense only at
the first iteration of !(nr_bytes >=bio->bi_size) case (when next_idx
== zero). Fix this by replacing bio->bi_idx with idx.
(This patch applies to 2.6.30-rc4.)

Signed-off-by: Kazuhisa Ichikawa <ki@epsilou.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
block/blk-core.c