diff options
author | Heinz Mauelshagen <heinzm@redhat.com> | 2023-02-07 20:22:58 +0100 |
---|---|---|
committer | Mike Snitzer <snitzer@kernel.org> | 2023-02-14 14:23:06 -0500 |
commit | 0d78954a2d80e648cfed1d306fffe52c6211c432 (patch) | |
tree | b3f9364a5e1e02d2daf75e636519cfa3d3938d3c | |
parent | 3bd940030752a33ff665eefdd74a1cdb74a4f9b0 (diff) | |
download | linux-stable-0d78954a2d80e648cfed1d306fffe52c6211c432.tar.gz linux-stable-0d78954a2d80e648cfed1d306fffe52c6211c432.tar.bz2 linux-stable-0d78954a2d80e648cfed1d306fffe52c6211c432.zip |
dm: prefer kmap_local_page() instead of deprecated kmap_atomic()
Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
-rw-r--r-- | drivers/md/dm-crypt.c | 24 | ||||
-rw-r--r-- | drivers/md/dm-log-writes.c | 12 |
2 files changed, 18 insertions, 18 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 7f48256db9b2..e892e52e961f 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -532,9 +532,9 @@ static int crypt_iv_lmk_gen(struct crypt_config *cc, u8 *iv, if (bio_data_dir(dmreq->ctx->bio_in) == WRITE) { sg = crypt_get_sg_data(cc, dmreq->sg_in); - src = kmap_atomic(sg_page(sg)); + src = kmap_local_page(sg_page(sg)); r = crypt_iv_lmk_one(cc, iv, dmreq, src + sg->offset); - kunmap_atomic(src); + kunmap_local(src); } else memset(iv, 0, cc->iv_size); @@ -552,14 +552,14 @@ static int crypt_iv_lmk_post(struct crypt_config *cc, u8 *iv, return 0; sg = crypt_get_sg_data(cc, dmreq->sg_out); - dst = kmap_atomic(sg_page(sg)); + dst = kmap_local_page(sg_page(sg)); r = crypt_iv_lmk_one(cc, iv, dmreq, dst + sg->offset); /* Tweak the first block of plaintext sector */ if (!r) crypto_xor(dst + sg->offset, iv, cc->iv_size); - kunmap_atomic(dst); + kunmap_local(dst); return r; } @@ -682,9 +682,9 @@ static int crypt_iv_tcw_gen(struct crypt_config *cc, u8 *iv, /* Remove whitening from ciphertext */ if (bio_data_dir(dmreq->ctx->bio_in) != WRITE) { sg = crypt_get_sg_data(cc, dmreq->sg_in); - src = kmap_atomic(sg_page(sg)); + src = kmap_local_page(sg_page(sg)); r = crypt_iv_tcw_whitening(cc, dmreq, src + sg->offset); - kunmap_atomic(src); + kunmap_local(src); } /* Calculate IV */ @@ -708,9 +708,9 @@ static int crypt_iv_tcw_post(struct crypt_config *cc, u8 *iv, /* Apply whitening on ciphertext */ sg = crypt_get_sg_data(cc, dmreq->sg_out); - dst = kmap_atomic(sg_page(sg)); + dst = kmap_local_page(sg_page(sg)); r = crypt_iv_tcw_whitening(cc, dmreq, dst + sg->offset); - kunmap_atomic(dst); + kunmap_local(dst); return r; } @@ -975,15 +975,15 @@ static int crypt_iv_elephant(struct crypt_config *cc, struct dm_crypt_request *d goto out; sg = crypt_get_sg_data(cc, dmreq->sg_out); - data = kmap_atomic(sg_page(sg)); + data = kmap_local_page(sg_page(sg)); data_offset = data + sg->offset; /* Cannot modify original bio, copy to sg_out and apply Elephant to it */ if (bio_data_dir(dmreq->ctx->bio_in) == WRITE) { sg2 = crypt_get_sg_data(cc, dmreq->sg_in); - data2 = kmap_atomic(sg_page(sg2)); + data2 = kmap_local_page(sg_page(sg2)); memcpy(data_offset, data2 + sg2->offset, cc->sector_size); - kunmap_atomic(data2); + kunmap_local(data2); } if (bio_data_dir(dmreq->ctx->bio_in) != WRITE) { @@ -1003,7 +1003,7 @@ static int crypt_iv_elephant(struct crypt_config *cc, struct dm_crypt_request *d diffuser_cpu_to_disk((__le32*)data_offset, cc->sector_size / sizeof(u32)); } - kunmap_atomic(data); + kunmap_local(data); out: kfree_sensitive(ks); kfree_sensitive(es); diff --git a/drivers/md/dm-log-writes.c b/drivers/md/dm-log-writes.c index 7c3b83536481..b126263f814c 100644 --- a/drivers/md/dm-log-writes.c +++ b/drivers/md/dm-log-writes.c @@ -232,13 +232,13 @@ static int write_metadata(struct log_writes_c *lc, void *entry, goto error; } - ptr = kmap_atomic(page); + ptr = kmap_local_page(page); memcpy(ptr, entry, entrylen); if (datalen) memcpy(ptr + entrylen, data, datalen); memset(ptr + entrylen + datalen, 0, lc->sectorsize - entrylen - datalen); - kunmap_atomic(ptr); + kunmap_local(ptr); ret = bio_add_page(bio, page, lc->sectorsize, 0); if (ret != lc->sectorsize) { @@ -287,11 +287,11 @@ static int write_inline_data(struct log_writes_c *lc, void *entry, goto error_bio; } - ptr = kmap_atomic(page); + ptr = kmap_local_page(page); memcpy(ptr, data, pg_datalen); if (pg_sectorlen > pg_datalen) memset(ptr + pg_datalen, 0, pg_sectorlen - pg_datalen); - kunmap_atomic(ptr); + kunmap_local(ptr); ret = bio_add_page(bio, page, pg_sectorlen, 0); if (ret != pg_sectorlen) { @@ -743,9 +743,9 @@ static int log_writes_map(struct dm_target *ti, struct bio *bio) return DM_MAPIO_KILL; } - dst = kmap_atomic(page); + dst = kmap_local_page(page); memcpy_from_bvec(dst, &bv); - kunmap_atomic(dst); + kunmap_local(dst); block->vecs[i].bv_page = page; block->vecs[i].bv_len = bv.bv_len; block->vec_cnt++; |