Skip to content

Commit 5779aa2

Browse files
committed
Merge tag 'fsverity-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt
Pull fsverity updates from Eric Biggers: "Minor changes to convert uses of kmap() to kmap_local_page()" * tag 'fsverity-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt: fs-verity: use kmap_local_page() instead of kmap() fs-verity: use memcpy_from_page()
2 parents 438b2cd + 8377e8a commit 5779aa2

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

fs/verity/read_metadata.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ static int fsverity_read_merkle_tree(struct inode *inode,
5353
break;
5454
}
5555

56-
virt = kmap(page);
56+
virt = kmap_local_page(page);
5757
if (copy_to_user(buf, virt + offs_in_page, bytes_to_copy)) {
58-
kunmap(page);
58+
kunmap_local(virt);
5959
put_page(page);
6060
err = -EFAULT;
6161
break;
6262
}
63-
kunmap(page);
63+
kunmap_local(virt);
6464
put_page(page);
6565

6666
retval += bytes_to_copy;

fs/verity/verify.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,6 @@ static void hash_at_level(const struct merkle_tree_params *params,
3939
(params->log_blocksize - params->log_arity);
4040
}
4141

42-
/* Extract a hash from a hash page */
43-
static void extract_hash(struct page *hpage, unsigned int hoffset,
44-
unsigned int hsize, u8 *out)
45-
{
46-
void *virt = kmap_atomic(hpage);
47-
48-
memcpy(out, virt + hoffset, hsize);
49-
kunmap_atomic(virt);
50-
}
51-
5242
static inline int cmp_hashes(const struct fsverity_info *vi,
5343
const u8 *want_hash, const u8 *real_hash,
5444
pgoff_t index, int level)
@@ -129,7 +119,7 @@ static bool verify_page(struct inode *inode, const struct fsverity_info *vi,
129119
}
130120

131121
if (PageChecked(hpage)) {
132-
extract_hash(hpage, hoffset, hsize, _want_hash);
122+
memcpy_from_page(_want_hash, hpage, hoffset, hsize);
133123
want_hash = _want_hash;
134124
put_page(hpage);
135125
pr_debug_ratelimited("Hash page already checked, want %s:%*phN\n",
@@ -158,7 +148,7 @@ static bool verify_page(struct inode *inode, const struct fsverity_info *vi,
158148
if (err)
159149
goto out;
160150
SetPageChecked(hpage);
161-
extract_hash(hpage, hoffset, hsize, _want_hash);
151+
memcpy_from_page(_want_hash, hpage, hoffset, hsize);
162152
want_hash = _want_hash;
163153
put_page(hpage);
164154
pr_debug("Verified hash page at level %d, now want %s:%*phN\n",

0 commit comments

Comments
 (0)