From: Muhammad Falak R Wani <falakreyaz@gmail.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] crypto: algif_skcipher: replace sg++ with sg_next()
Date: Wed, 4 May 2016 00:28:08 +0530 [thread overview]
Message-ID: <1462301939-23578-1-git-send-email-falakreyaz@gmail.com> (raw)
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
next reply other threads:[~2016-05-03 18:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-03 18:58 Muhammad Falak R Wani [this message]
2016-05-04 4:09 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1462301939-23578-1-git-send-email-falakreyaz@gmail.com \
--to=falakreyaz@gmail.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®