From: Cristian Stoica <cristian.sto...@freescale.com>

For in-place operations, the scatterlist must be big enough to allow for
either the source or destination data:
 - for block ciphers, the destination will be bigger than the source if
   the source is not multiple of blocksize
 - for aead ciphers, the additional data and padding guarantees the
   destination to be bigger than the source.

Signed-off-by: Cristian Stoica <cristian.sto...@freescale.com>
Reviewed-by: Mircea Pop <mircea....@freescale.com>
Reviewed-by: Alexandru Porosanu <alexandru.poros...@freescale.com>
Reviewed-by: Horia Ioan Geanta Neag <horia.gea...@freescale.com>
Tested-by: Horia Ioan Geanta Neag <horia.gea...@freescale.com>
Signed-off-by: Horia Geanta <horia.gea...@freescale.com>
---
 zc.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/zc.c b/zc.c
index 11492e4..2537ca4 100644
--- a/zc.c
+++ b/zc.c
@@ -162,8 +162,9 @@ int get_userbuf(struct csession *ses,
        }
 
        if (src == dst) {       /* inplace operation */
-               rc = __get_userbuf(src, src_len, 1, ses->used_pages,
-                                      ses->pages, ses->sg, task, mm);
+               rc = __get_userbuf(src, max(src_len, dst_len), 1, 
ses->used_pages,
+                               ses->pages, ses->sg, task, mm);
+
                if (unlikely(rc)) {
                        dprintk(1, KERN_ERR,
                                "failed to get user pages for data IO\n");
-- 
1.7.7.6



_______________________________________________
Cryptodev-linux-devel mailing list
Cryptodev-linux-devel@gna.org
https://mail.gna.org/listinfo/cryptodev-linux-devel

Reply via email to