aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto/stm32/stm32-hash.c
diff options
context:
space:
mode:
authorThomas Bourgoin <[email protected]>2023-07-13 15:15:15 +0000
committerHerbert Xu <[email protected]>2023-07-22 01:59:38 +0000
commitd9c83f71eeceed2cb54bb78be84f2d4055fd9a1f (patch)
treeb4ddbf90aafe9942ed269027a86e9cde85372769 /drivers/crypto/stm32/stm32-hash.c
parentcrypto: stm32 - remove bufcnt in stm32_hash_write_ctrl. (diff)
downloadkernel-d9c83f71eeceed2cb54bb78be84f2d4055fd9a1f.tar.gz
kernel-d9c83f71eeceed2cb54bb78be84f2d4055fd9a1f.zip
crypto: stm32 - fix loop iterating through scatterlist for DMA
We were reading the length of the scatterlist sg after copying value of tsg inside. So we are using the size of the previous scatterlist and for the first one we are using an unitialised value. Fix this by copying tsg in sg[0] before reading the size. Fixes : 8a1012d3f2ab ("crypto: stm32 - Support for STM32 HASH module") Cc: [email protected] Signed-off-by: Thomas Bourgoin <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
Diffstat (limited to 'drivers/crypto/stm32/stm32-hash.c')
-rw-r--r--drivers/crypto/stm32/stm32-hash.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32-hash.c
index c179a6c1a457..519fb716acee 100644
--- a/drivers/crypto/stm32/stm32-hash.c
+++ b/drivers/crypto/stm32/stm32-hash.c
@@ -678,9 +678,9 @@ static int stm32_hash_dma_send(struct stm32_hash_dev *hdev)
}
for_each_sg(rctx->sg, tsg, rctx->nents, i) {
+ sg[0] = *tsg;
len = sg->length;
- sg[0] = *tsg;
if (sg_is_last(sg)) {
if (hdev->dma_mode == 1) {
len = (ALIGN(sg->length, 16) - 16);