Skip to content
Commit b21e11c5 authored by Ming Lei's avatar Ming Lei Committed by Jens Axboe
Browse files

block: fix build warning in merging bvecs



Commit f6970f83 ("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: default avatarJens Axboe <axboe@kernel.dk>
Fixes: f6970f83 ("block: don't check if adjacent bvecs in one bio can be mergeable")
Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 636b8fe8
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment