]> git.baikalelectronics.ru Git - kernel.git/commit
block: fix build warning in merging bvecs
authorMing Lei <ming.lei@redhat.com>
Tue, 2 Apr 2019 02:26:44 +0000 (10:26 +0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 8 Apr 2019 16:57:10 +0000 (10:57 -0600)
commite7e5a6d20aab538940eba33bd26a0c76ad3cccb3
tree0c2becff5ec805afd350fd73e8f446f52f925de9
parentbaa0a7bcd7c40f32a74aab3bee4260ef8f1bffdc
block: fix build warning in merging bvecs

Commit 66c5760cf7b4 ("block: don't check if adjacent bvecs in one bio can
be mergeable") changes bvec merge by only considering two bvecs from
different bios. However, if the former bio doesn't inlcude any io bvec,
then the following warning may be triggered:

 warning: ‘bvec.bv_offset’ may be used uninitialized in this function [-Wmaybe-uninitialized]

In practice, it shouldn't be triggered.

Fixes it by adding check on former bio, the check shouldn't add any cost
given 'bio->bi_iter' can be hit in cache.

Reported-by: Jens Axboe <axboe@kernel.dk>
Fixes: 66c5760cf7b4 ("block: don't check if adjacent bvecs in one bio can be mergeable")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-merge.c