Skip to content

Commit 5656687

Browse files
dhowellsgregkh
authored andcommitted
crypto: af_alg: Indent the loop in af_alg_sendmsg()
[ Upstream commit 73d7409 ] 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: 9574b23 ("crypto: af_alg - Set merge to zero early in af_alg_sendmsg") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent d85f098 commit 5656687

File tree

1 file changed

+27
-24
lines changed

1 file changed

+27
-24
lines changed

crypto/af_alg.c

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -927,35 +927,38 @@ int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size,
927927
if (sgl->cur)
928928
sg_unmark_end(sg + sgl->cur - 1);
929929

930-
do {
931-
struct page *pg;
932-
unsigned int i = sgl->cur;
930+
if (1 /* TODO check MSG_SPLICE_PAGES */) {
931+
do {
932+
struct page *pg;
933+
unsigned int i = sgl->cur;
933934

934-
plen = min_t(size_t, len, PAGE_SIZE);
935+
plen = min_t(size_t, len, PAGE_SIZE);
935936

936-
pg = alloc_page(GFP_KERNEL);
937-
if (!pg) {
938-
err = -ENOMEM;
939-
goto unlock;
940-
}
937+
pg = alloc_page(GFP_KERNEL);
938+
if (!pg) {
939+
err = -ENOMEM;
940+
goto unlock;
941+
}
941942

942-
sg_assign_page(sg + i, pg);
943+
sg_assign_page(sg + i, pg);
943944

944-
err = memcpy_from_msg(page_address(sg_page(sg + i)),
945-
msg, plen);
946-
if (err) {
947-
__free_page(sg_page(sg + i));
948-
sg_assign_page(sg + i, NULL);
949-
goto unlock;
950-
}
945+
err = memcpy_from_msg(
946+
page_address(sg_page(sg + i)),
947+
msg, plen);
948+
if (err) {
949+
__free_page(sg_page(sg + i));
950+
sg_assign_page(sg + i, NULL);
951+
goto unlock;
952+
}
951953

952-
sg[i].length = plen;
953-
len -= plen;
954-
ctx->used += plen;
955-
copied += plen;
956-
size -= plen;
957-
sgl->cur++;
958-
} while (len && sgl->cur < MAX_SGL_ENTS);
954+
sg[i].length = plen;
955+
len -= plen;
956+
ctx->used += plen;
957+
copied += plen;
958+
size -= plen;
959+
sgl->cur++;
960+
} while (len && sgl->cur < MAX_SGL_ENTS);
961+
}
959962

960963
if (!size)
961964
sg_mark_end(sg + sgl->cur - 1);

0 commit comments

Comments
 (0)