Skip to contentSkip to conversation

crypto: rockchip - drop redundant crypto_skcipher_ivsize() calls

PATCH In review Karina Yankevich 3 participants 3 messages Nov 5, 2025 – Nov 14, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: rockchip - drop redundant crypto_skcipher_ivsize() calls

The function already initialized the ivsize variable at the point of declaration, let's use it instead of calling crypto_skcipher_ivsize() extra couple times.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes 57d67c6e8219 ("crypto: rockchip - rework by using crypto_engine")
---
 drivers/crypto/rockchip/rk3288_crypto_skcipher.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/crypto/rockchip/rk3288_crypto_skcipher.c +1 -2
index 9393e10671c2..e80f9148c012 100644
@@ -321,8 +321,7 @@ static int rk_cipher_run(struct crypto_engine *engine, void *async_req)
 	algt->stat_req++;
 	rkc->nreq++;
 
-	ivsize = crypto_skcipher_ivsize(tfm);
-	if (areq->iv && crypto_skcipher_ivsize(tfm) > 0) {
+	if (areq->iv && ivsize > 0) {
 		if (rctx->mode & RK_CRYPTO_DEC) {
 			offset = areq->cryptlen - ivsize;
 			scatterwalk_map_and_copy(rctx->backup_iv, areq->src,
Signature · 1 line
2.34.1
#1 lore raw
Quoted 3 lines

The function already initialized the ivsize variable at the point of declaration, let's use it instead of calling crypto_skcipher_ivsize() extra couple times.

…

* You may occasionally put more than 52 characters into text lines of such a change description.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.18-rc4#n658

* How do you think about to reduce the scope for such a local variable?

Regards,
Markus

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

maintainer
#2 lore raw
In reply to Karina Yankevich
Quoted 4 lines · Karina Yankevich

The function already initialized the ivsize variable at the point of declaration, let's use it instead of calling crypto_skcipher_ivsize() extra couple times.

Quoted 8 lines

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes 57d67c6e8219 ("crypto: rockchip - rework by using crypto_engine")
---
 drivers/crypto/rockchip/rk3288_crypto_skcipher.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt