]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
block: bio_iov_iter_get_pages: fix size of last iovec
authorMartin Wilck <mwilck@suse.com>
Tue, 9 Oct 2018 16:04:00 +0000 (18:04 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 10 Oct 2018 08:32:52 +0000 (10:32 +0200)
commitc1427d8195839c1dce7dabf23f3ef50f244970db
treee5a283c1d4bf821a4b26e996bf137dd3de233d75
parenta5db5c8fa08b4bab5e9f41de5575adf753e4bb86
block: bio_iov_iter_get_pages: fix size of last iovec

BugLink: https://bugs.launchpad.net/bugs/1796542
If the last page of the bio is not "full", the length of the last
vector slot needs to be corrected. This slot has the index
(bio->bi_vcnt - 1), but only in bio->bi_io_vec. In the "bv" helper
array, which is shifted by the value of bio->bi_vcnt at function
invocation, the correct index is (nr_pages - 1).

v2: improved readability following suggestions from Ming Lei.
v3: followed a formatting suggestion from Christoph Hellwig.

Fixes: 2cefe4dbaadf ("block: add bio_iov_iter_get_pages()")
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit b403ea2404889e1227812fa9657667a1deb9c694)
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
block/bio.c