Skip to contentSkip to conversation

crypto: sun8i-ss: do not use sg_dma_len before calling DMA functions

PATCH Superseded Corentin Labbe 1 participant 2 messages Apr 27, 2025

Subsystems (4)
lore
Share & tools
lore

Corentin Labbe

author maintainer
#0 lore raw

PATCH 1/1 crypto: sun8i-ss: do not use sg_dma_len before calling DMA functions

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

---

If someone know why sunxi_defconfig have sg_dma_len() which always works even with any DMA call not done.

 drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c +1 -1
index 4caf17310e90..ddec1b08d4f6 100644
@@ -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;
 		}
Signature · 1 line
2.49.0
author maintainer
#1 lore raw
Quoted 10 lines · Corentin Labbe

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

---

Sorry my system didnt generate correct CC/TO, please ignore. I resend on correct people.