* [PATCH] crypto: algif_skcipher: replace sg++ with sg_next()
@ 2016-05-03 18:58 Muhammad Falak R Wani
2016-05-04 4:09 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Muhammad Falak R Wani @ 2016-05-03 18:58 UTC (permalink / raw)
To: Herbert Xu; +Cc: David S. Miller, linux-crypto, linux-kernel
Never use sg++, always use sg = sg_next(sg). Scatterlist entries can
be combined if the memory is contiguous but sg++ won't know about
that. It sure would run on the slower side.
But regardless, sg++ should never be used, only sg_next is safe.
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
---
crypto/algif_skcipher.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
index 28556fc..a668867 100644
--- a/crypto/algif_skcipher.c
+++ b/crypto/algif_skcipher.c
@@ -489,7 +489,7 @@ static int skcipher_all_sg_nents(struct skcipher_ctx *ctx)
sg = sgl->sg;
while (!sg->length)
- sg++;
+ sg = sg_next(sg);
nents += sg_nents(sg);
}
@@ -553,7 +553,7 @@ static int skcipher_recvmsg_async(struct socket *sock, struct msghdr *msg,
sg = sgl->sg;
while (!sg->length)
- sg++;
+ sg = sg_next(sg);
used = min_t(unsigned long, ctx->used,
iov_iter_count(&msg->msg_iter));
@@ -676,7 +676,7 @@ static int skcipher_recvmsg_sync(struct socket *sock, struct msghdr *msg,
sg = sgl->sg;
while (!sg->length)
- sg++;
+ sg = sg_next(sg);
skcipher_request_set_crypt(&ctx->req, sg, ctx->rsgl.sg, used,
ctx->iv);
--
1.9.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: algif_skcipher: replace sg++ with sg_next()
2016-05-03 18:58 [PATCH] crypto: algif_skcipher: replace sg++ with sg_next() Muhammad Falak R Wani
@ 2016-05-04 4:09 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2016-05-04 4:09 UTC (permalink / raw)
To: Muhammad Falak R Wani; +Cc: davem, linux-crypto, linux-kernel
Muhammad Falak R Wani <falakreyaz@gmail.com> wrote:
> Never use sg++, always use sg = sg_next(sg). Scatterlist entries can
> be combined if the memory is contiguous but sg++ won't know about
> that. It sure would run on the slower side.
> But regardless, sg++ should never be used, only sg_next is safe.
>
> Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
No please the only difference between sg_next and sg++ is chaining,
which is irrelevant here.
Patch rejected.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-04 4:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-03 18:58 [PATCH] crypto: algif_skcipher: replace sg++ with sg_next() Muhammad Falak R Wani
2016-05-04 4:09 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®