summaryrefslogtreecommitdiff
path: root/crypto/af_alg.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2023-06-06 14:08:53 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-09-25 10:58:54 +0200
commit56566873dadf7c30ec907e3ac17286b0d99f30a7 (patch)
tree4358d7040a256653d7f65211dfa2f9ffd2ed6fa9 /crypto/af_alg.c
parentd85f098950f39f0e326917dceb7b9f4ba989b8d7 (diff)
downloadlinux-56566873dadf7c30ec907e3ac17286b0d99f30a7.tar.gz
linux-56566873dadf7c30ec907e3ac17286b0d99f30a7.tar.bz2
linux-56566873dadf7c30ec907e3ac17286b0d99f30a7.zip
crypto: af_alg: Indent the loop in af_alg_sendmsg()
[ Upstream commit 73d7409cfdad7fd08a9203eb2912c1c77e527776 ] Put the loop in af_alg_sendmsg() into an if-statement to indent it to make the next patch easier to review as that will add another branch to handle MSG_SPLICE_PAGES to the if-statement. Signed-off-by: David Howells <dhowells@redhat.com> cc: Herbert Xu <herbert@gondor.apana.org.au> cc: "David S. Miller" <davem@davemloft.net> cc: Eric Dumazet <edumazet@google.com> cc: Jakub Kicinski <kuba@kernel.org> cc: Paolo Abeni <pabeni@redhat.com> cc: Jens Axboe <axboe@kernel.dk> cc: Matthew Wilcox <willy@infradead.org> cc: linux-crypto@vger.kernel.org cc: netdev@vger.kernel.org Acked-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Stable-dep-of: 9574b2330dbd ("crypto: af_alg - Set merge to zero early in af_alg_sendmsg") Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'crypto/af_alg.c')
-rw-r--r--crypto/af_alg.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/crypto/af_alg.c b/crypto/af_alg.c
index fef69d2a6b18..d5a8368a47c5 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -927,35 +927,38 @@ int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size,
if (sgl->cur)
sg_unmark_end(sg + sgl->cur - 1);
- do {
- struct page *pg;
- unsigned int i = sgl->cur;
+ if (1 /* TODO check MSG_SPLICE_PAGES */) {
+ do {
+ struct page *pg;
+ unsigned int i = sgl->cur;
- plen = min_t(size_t, len, PAGE_SIZE);
+ plen = min_t(size_t, len, PAGE_SIZE);
- pg = alloc_page(GFP_KERNEL);
- if (!pg) {
- err = -ENOMEM;
- goto unlock;
- }
+ pg = alloc_page(GFP_KERNEL);
+ if (!pg) {
+ err = -ENOMEM;
+ goto unlock;
+ }
- sg_assign_page(sg + i, pg);
+ sg_assign_page(sg + i, pg);
- err = memcpy_from_msg(page_address(sg_page(sg + i)),
- msg, plen);
- if (err) {
- __free_page(sg_page(sg + i));
- sg_assign_page(sg + i, NULL);
- goto unlock;
- }
+ err = memcpy_from_msg(
+ page_address(sg_page(sg + i)),
+ msg, plen);
+ if (err) {
+ __free_page(sg_page(sg + i));
+ sg_assign_page(sg + i, NULL);
+ goto unlock;
+ }
- sg[i].length = plen;
- len -= plen;
- ctx->used += plen;
- copied += plen;
- size -= plen;
- sgl->cur++;
- } while (len && sgl->cur < MAX_SGL_ENTS);
+ sg[i].length = plen;
+ len -= plen;
+ ctx->used += plen;
+ copied += plen;
+ size -= plen;
+ sgl->cur++;
+ } while (len && sgl->cur < MAX_SGL_ENTS);
+ }
if (!size)
sg_mark_end(sg + sgl->cur - 1);