crypto: sun8i-ss - do not use sg_dma_len before calling DMA functions
authorCorentin Labbe <clabbe.montjoie@gmail.com>
Sun, 27 Apr 2025 11:12:36 +0000 (13:12 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 28 Apr 2025 11:45:26 +0000 (19:45 +0800)
When testing sun8i-ss with multi_v7_defconfig, all CBC algorithm fail crypto
selftests.
This is strange since on sunxi_defconfig, everything was ok.
The problem was in the IV setup loop which never run because sg_dma_len
was 0.

Fixes: 359e893e8af4 ("crypto: sun8i-ss - rework handling of IV")
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c

index 9b9605ce8ee629c80c80d63f84d94a5913a325ad..8831bcb230c2d4c32a49c2506019deaceb7068b8 100644 (file)
@@ -141,7 +141,7 @@ static int sun8i_ss_setup_ivs(struct skcipher_request *areq)
 
        /* we need to copy all IVs from source in case DMA is bi-directionnal */
        while (sg && len) {
-               if (sg_dma_len(sg) == 0) {
+               if (sg->length == 0) {
                        sg = sg_next(sg);
                        continue;
                }