Skip to content

Commit ce33135

Browse files
committed
crypto: hash - Use nth_page instead of doing it by hand
Use nth_page instead of adding n to the page pointer. Signed-off-by: Herbert Xu <[email protected]>
1 parent e9ed7af commit ce33135

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crypto/ahash.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static int hash_walk_new_entry(struct crypto_hash_walk *walk)
8080

8181
sg = walk->sg;
8282
walk->offset = sg->offset;
83-
walk->pg = sg_page(walk->sg) + (walk->offset >> PAGE_SHIFT);
83+
walk->pg = nth_page(sg_page(walk->sg), (walk->offset >> PAGE_SHIFT));
8484
walk->offset = offset_in_page(walk->offset);
8585
walk->entrylen = sg->length;
8686

@@ -221,7 +221,7 @@ int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc)
221221
if (!IS_ENABLED(CONFIG_HIGHMEM))
222222
return crypto_shash_digest(desc, data, nbytes, req->result);
223223

224-
page += offset >> PAGE_SHIFT;
224+
page = nth_page(page, offset >> PAGE_SHIFT);
225225
offset = offset_in_page(offset);
226226

227227
if (nbytes > (unsigned int)PAGE_SIZE - offset)

0 commit comments

Comments
 (0)