linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] crypto: tcrypt - fix S/G table for test_aead_speed()
@ 2017-10-10 10:21 Robert Baronescu
  2017-10-10 10:22 ` [PATCH 2/2] crypto: tcrypt - fix buffer lengths in test_aead_speed() Robert Baronescu
                   ` (3 more replies)
  0 siblings, 4 replies; 22+ messages in thread
From: Robert Baronescu @ 2017-10-10 10:21 UTC (permalink / raw)
  To: herbert; +Cc: linux-crypto, davem, Robert Baronescu

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

^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2017-11-29 10:23 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-10 10:21 [PATCH 1/2] crypto: tcrypt - fix S/G table for test_aead_speed() Robert Baronescu
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

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).