aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2025-09-01 17:03:54 +0200
committerAndrew Morton <akpm@linux-foundation.org>2025-09-21 14:22:09 -0700
commitce00897b94bc5c62fab962625efcf1ab824d3688 (patch)
treefc5e8f2b58b764098807da9c74e4512f8614a973 /crypto
parentfae6406bca03688bde691ef7f2605165d6b4f9b8 (diff)
downloadnet-ce00897b94bc5c62fab962625efcf1ab824d3688.tar.gz
crypto: remove nth_page() usage within SG entry
It's no longer required to use nth_page() when iterating pages within a single SG entry, so let's drop the nth_page() usage. Link: https://lkml.kernel.org/r/20250901150359.867252-34-david@redhat.com Signed-off-by: David Hildenbrand <david@redhat.com> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Acked-by: Herbert Xu <herbert@gondor.apana.org.au> Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/ahash.c4
-rw-r--r--crypto/scompress.c8
2 files changed, 6 insertions, 6 deletions
diff --git a/crypto/ahash.c b/crypto/ahash.c
index a227793d2c5b58..dfb4f5476428fc 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -88,7 +88,7 @@ static int hash_walk_new_entry(struct crypto_hash_walk *walk)
sg = walk->sg;
walk->offset = sg->offset;
- walk->pg = nth_page(sg_page(walk->sg), (walk->offset >> PAGE_SHIFT));
+ walk->pg = sg_page(walk->sg) + (walk->offset >> PAGE_SHIFT);
walk->offset = offset_in_page(walk->offset);
walk->entrylen = sg->length;
@@ -226,7 +226,7 @@ int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc)
if (!IS_ENABLED(CONFIG_HIGHMEM))
return crypto_shash_digest(desc, data, nbytes, req->result);
- page = nth_page(page, offset >> PAGE_SHIFT);
+ page += offset >> PAGE_SHIFT;
offset = offset_in_page(offset);
if (nbytes > (unsigned int)PAGE_SIZE - offset)
diff --git a/crypto/scompress.c b/crypto/scompress.c
index c651e7f2197a97..1a7ed8ae65b074 100644
--- a/crypto/scompress.c
+++ b/crypto/scompress.c
@@ -198,7 +198,7 @@ static int scomp_acomp_comp_decomp(struct acomp_req *req, int dir)
} else
return -ENOSYS;
- dpage = nth_page(dpage, doff / PAGE_SIZE);
+ dpage += doff / PAGE_SIZE;
doff = offset_in_page(doff);
n = (dlen - 1) / PAGE_SIZE;
@@ -220,12 +220,12 @@ static int scomp_acomp_comp_decomp(struct acomp_req *req, int dir)
} else
break;
- spage = nth_page(spage, soff / PAGE_SIZE);
+ spage = spage + soff / PAGE_SIZE;
soff = offset_in_page(soff);
n = (slen - 1) / PAGE_SIZE;
n += (offset_in_page(slen - 1) + soff) / PAGE_SIZE;
- if (PageHighMem(nth_page(spage, n)) &&
+ if (PageHighMem(spage + n) &&
size_add(soff, slen) > PAGE_SIZE)
break;
src = kmap_local_page(spage) + soff;
@@ -270,7 +270,7 @@ static int scomp_acomp_comp_decomp(struct acomp_req *req, int dir)
if (dlen <= PAGE_SIZE)
break;
dlen -= PAGE_SIZE;
- dpage = nth_page(dpage, 1);
+ dpage++;
}
}