linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert Baronescu <robert.baronescu@nxp.com>
To: <herbert@gondor.apana.org.au>
Cc: <linux-crypto@vger.kernel.org>, <davem@davemloft.net>,
	Robert Baronescu <robert.baronescu@nxp.com>
Subject: [PATCH 1/2] crypto: tcrypt - fix S/G table for test_aead_speed()
Date: Tue, 10 Oct 2017 13:21:59 +0300	[thread overview]
Message-ID: <1507630920-9014-1-git-send-email-robert.baronescu@nxp.com> (raw)

In case buffer length is a multiple of PAGE_SIZE,
the S/G table is incorrectly generated.
Fix this by handling buflen = k * PAGE_SIZE separately.

Signed-off-by: Robert Baronescu <robert.baronescu@nxp.com>
---
 crypto/tcrypt.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 0022a18..bd9b66c 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -221,11 +221,13 @@ static void sg_init_aead(struct scatterlist *sg, char *xbuf[XBUFSIZE],
 	}
 
 	sg_init_table(sg, np + 1);
-	np--;
+	if (rem)
+		np--;
 	for (k = 0; k < np; k++)
 		sg_set_buf(&sg[k + 1], xbuf[k], PAGE_SIZE);
 
-	sg_set_buf(&sg[k + 1], xbuf[k], rem);
+	if (rem)
+		sg_set_buf(&sg[k + 1], xbuf[k], rem);
 }
 
 static void test_aead_speed(const char *algo, int enc, unsigned int secs,
-- 
1.9.3

             reply	other threads:[~2017-10-10 10:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-10 10:21 Robert Baronescu [this message]
2017-10-10 10:22 ` [PATCH 2/2] crypto: tcrypt - fix buffer lengths in test_aead_speed() Robert Baronescu
2017-11-03 14:22   ` Herbert Xu
2017-11-03 12:41 ` [PATCH 1/2] crypto: tcrypt - fix S/G table for test_aead_speed() Herbert Xu
2017-11-09 14:37   ` Horia Geantă
2017-11-09 22:21     ` Herbert Xu
2017-11-10  6:37       ` Horia Geantă
2017-11-10  7:43         ` Herbert Xu
2017-11-10  9:17           ` Horia Geantă
2017-11-10 10:41             ` Herbert Xu
2017-11-12 16:26               ` Horia Geantă
2017-11-13 18:27                 ` Tudor Ambarus
2017-11-14 10:41                   ` Horia Geantă
2017-11-14 14:59                   ` [PATCH] crypto: tcrypt - set assoc in sg_init_aead() Tudor Ambarus
2017-11-15  9:11                     ` Horia Geantă
2017-11-29  6:36                     ` Herbert Xu
2017-11-14 10:45                 ` [PATCH 1/2] crypto: tcrypt - fix S/G table for test_aead_speed() Herbert Xu
2017-11-13 18:24 ` Tudor Ambarus
2017-11-14 10:02   ` Horia Geantă
2017-11-29  6:28 ` [1/2] " Herbert Xu
2017-11-29  8:57   ` Horia Geantă
2017-11-29 10:23     ` 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=1507630920-9014-1-git-send-email-robert.baronescu@nxp.com \
    --to=robert.baronescu@nxp.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@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;
as well as URLs for NNTP newsgroup(s).