Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

David Hildenbrand and committed by
Andrew Morton
ce00897b fae6406b

+8 -8
+2 -2
crypto/ahash.c
··· 88 88 89 89 sg = walk->sg; 90 90 walk->offset = sg->offset; 91 - walk->pg = nth_page(sg_page(walk->sg), (walk->offset >> PAGE_SHIFT)); 91 + walk->pg = sg_page(walk->sg) + (walk->offset >> PAGE_SHIFT); 92 92 walk->offset = offset_in_page(walk->offset); 93 93 walk->entrylen = sg->length; 94 94 ··· 226 226 if (!IS_ENABLED(CONFIG_HIGHMEM)) 227 227 return crypto_shash_digest(desc, data, nbytes, req->result); 228 228 229 - page = nth_page(page, offset >> PAGE_SHIFT); 229 + page += offset >> PAGE_SHIFT; 230 230 offset = offset_in_page(offset); 231 231 232 232 if (nbytes > (unsigned int)PAGE_SIZE - offset)
+4 -4
crypto/scompress.c
··· 198 198 } else 199 199 return -ENOSYS; 200 200 201 - dpage = nth_page(dpage, doff / PAGE_SIZE); 201 + dpage += doff / PAGE_SIZE; 202 202 doff = offset_in_page(doff); 203 203 204 204 n = (dlen - 1) / PAGE_SIZE; ··· 220 220 } else 221 221 break; 222 222 223 - spage = nth_page(spage, soff / PAGE_SIZE); 223 + spage = spage + soff / PAGE_SIZE; 224 224 soff = offset_in_page(soff); 225 225 226 226 n = (slen - 1) / PAGE_SIZE; 227 227 n += (offset_in_page(slen - 1) + soff) / PAGE_SIZE; 228 - if (PageHighMem(nth_page(spage, n)) && 228 + if (PageHighMem(spage + n) && 229 229 size_add(soff, slen) > PAGE_SIZE) 230 230 break; 231 231 src = kmap_local_page(spage) + soff; ··· 270 270 if (dlen <= PAGE_SIZE) 271 271 break; 272 272 dlen -= PAGE_SIZE; 273 - dpage = nth_page(dpage, 1); 273 + dpage++; 274 274 } 275 275 } 276 276
+2 -2
include/crypto/scatterwalk.h
··· 159 159 if (IS_ENABLED(CONFIG_HIGHMEM)) { 160 160 struct page *page; 161 161 162 - page = nth_page(base_page, offset >> PAGE_SHIFT); 162 + page = base_page + (offset >> PAGE_SHIFT); 163 163 offset = offset_in_page(offset); 164 164 addr = kmap_local_page(page) + offset; 165 165 } else { ··· 259 259 end += (offset_in_page(offset) + offset_in_page(nbytes) + 260 260 PAGE_SIZE - 1) >> PAGE_SHIFT; 261 261 for (i = start; i < end; i++) 262 - flush_dcache_page(nth_page(base_page, i)); 262 + flush_dcache_page(base_page + i); 263 263 } 264 264 scatterwalk_advance(walk, nbytes); 265 265 }