dm verity: use bvec_kmap_local in verity_for_bv_block
authorChristoph Hellwig <hch@lst.de>
Tue, 19 Oct 2021 13:44:06 +0000 (15:44 +0200)
committerMike Snitzer <snitzer@redhat.com>
Mon, 1 Nov 2021 17:28:48 +0000 (13:28 -0400)
Using local kmaps slightly reduces the chances to stray writes, and
the bvec interface cleans up the code a little bit.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-verity-target.c

index 88288c8..c6e52fd 100644 (file)
@@ -427,14 +427,14 @@ int verity_for_bv_block(struct dm_verity *v, struct dm_verity_io *io,
                unsigned len;
                struct bio_vec bv = bio_iter_iovec(bio, *iter);
 
-               page = kmap_atomic(bv.bv_page);
+               page = bvec_kmap_local(&bv);
                len = bv.bv_len;
 
                if (likely(len >= todo))
                        len = todo;
 
-               r = process(v, io, page + bv.bv_offset, len);
-               kunmap_atomic(page);
+               r = process(v, io, page, len);
+               kunmap_local(page);
 
                if (r < 0)
                        return r;