mirror of https://github.com/torvalds/linux.git
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>
This commit is contained in:
parent
fae6406bca
commit
ce00897b94
|
|
@ -88,7 +88,7 @@ static int hash_walk_new_entry(struct crypto_hash_walk *walk)
|
||||||
|
|
||||||
sg = walk->sg;
|
sg = walk->sg;
|
||||||
walk->offset = sg->offset;
|
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->offset = offset_in_page(walk->offset);
|
||||||
walk->entrylen = sg->length;
|
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))
|
if (!IS_ENABLED(CONFIG_HIGHMEM))
|
||||||
return crypto_shash_digest(desc, data, nbytes, req->result);
|
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);
|
offset = offset_in_page(offset);
|
||||||
|
|
||||||
if (nbytes > (unsigned int)PAGE_SIZE - offset)
|
if (nbytes > (unsigned int)PAGE_SIZE - offset)
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,7 @@ static int scomp_acomp_comp_decomp(struct acomp_req *req, int dir)
|
||||||
} else
|
} else
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
|
|
||||||
dpage = nth_page(dpage, doff / PAGE_SIZE);
|
dpage += doff / PAGE_SIZE;
|
||||||
doff = offset_in_page(doff);
|
doff = offset_in_page(doff);
|
||||||
|
|
||||||
n = (dlen - 1) / PAGE_SIZE;
|
n = (dlen - 1) / PAGE_SIZE;
|
||||||
|
|
@ -220,12 +220,12 @@ static int scomp_acomp_comp_decomp(struct acomp_req *req, int dir)
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
|
|
||||||
spage = nth_page(spage, soff / PAGE_SIZE);
|
spage = spage + soff / PAGE_SIZE;
|
||||||
soff = offset_in_page(soff);
|
soff = offset_in_page(soff);
|
||||||
|
|
||||||
n = (slen - 1) / PAGE_SIZE;
|
n = (slen - 1) / PAGE_SIZE;
|
||||||
n += (offset_in_page(slen - 1) + soff) / 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)
|
size_add(soff, slen) > PAGE_SIZE)
|
||||||
break;
|
break;
|
||||||
src = kmap_local_page(spage) + soff;
|
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)
|
if (dlen <= PAGE_SIZE)
|
||||||
break;
|
break;
|
||||||
dlen -= PAGE_SIZE;
|
dlen -= PAGE_SIZE;
|
||||||
dpage = nth_page(dpage, 1);
|
dpage++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ static inline void scatterwalk_map(struct scatter_walk *walk)
|
||||||
if (IS_ENABLED(CONFIG_HIGHMEM)) {
|
if (IS_ENABLED(CONFIG_HIGHMEM)) {
|
||||||
struct page *page;
|
struct page *page;
|
||||||
|
|
||||||
page = nth_page(base_page, offset >> PAGE_SHIFT);
|
page = base_page + (offset >> PAGE_SHIFT);
|
||||||
offset = offset_in_page(offset);
|
offset = offset_in_page(offset);
|
||||||
addr = kmap_local_page(page) + offset;
|
addr = kmap_local_page(page) + offset;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -259,7 +259,7 @@ static inline void scatterwalk_done_dst(struct scatter_walk *walk,
|
||||||
end += (offset_in_page(offset) + offset_in_page(nbytes) +
|
end += (offset_in_page(offset) + offset_in_page(nbytes) +
|
||||||
PAGE_SIZE - 1) >> PAGE_SHIFT;
|
PAGE_SIZE - 1) >> PAGE_SHIFT;
|
||||||
for (i = start; i < end; i++)
|
for (i = start; i < end; i++)
|
||||||
flush_dcache_page(nth_page(base_page, i));
|
flush_dcache_page(base_page + i);
|
||||||
}
|
}
|
||||||
scatterwalk_advance(walk, nbytes);
|
scatterwalk_advance(walk, nbytes);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue