mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] crypto: rockchip - drop redundant crypto_skcipher_ivsize() calls
@ 2025-11-05 14:52 Karina Yankevich
  2025-11-05 16:55 ` Markus Elfring
  2025-11-14 10:20 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Karina Yankevich @ 2025-11-05 14:52 UTC (permalink / raw)
  To: Corentin Labbe
  Cc: Karina Yankevich, Herbert Xu, David S. Miller, linux-crypto,
	linux-rockchip, linux-kernel, lvc-project, Sergey Shtylyov

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")
Signed-off-by: Karina Yankevich <k.yankevich@omp.ru>
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
 drivers/crypto/rockchip/rk3288_crypto_skcipher.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/crypto/rockchip/rk3288_crypto_skcipher.c b/drivers/crypto/rockchip/rk3288_crypto_skcipher.c
index 9393e10671c2..e80f9148c012 100644
--- a/drivers/crypto/rockchip/rk3288_crypto_skcipher.c
+++ b/drivers/crypto/rockchip/rk3288_crypto_skcipher.c
@@ -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,
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] crypto: rockchip - drop redundant crypto_skcipher_ivsize() calls
  2025-11-05 14:52 [PATCH] crypto: rockchip - drop redundant crypto_skcipher_ivsize() calls Karina Yankevich
@ 2025-11-05 16:55 ` Markus Elfring
  2025-11-14 10:20 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2025-11-05 16:55 UTC (permalink / raw)
  To: Karina Yankevich, linux-crypto, linux-rockchip, lvc-project,
	Corentin Labbe, Sergey Shtylyov
  Cc: LKML, David S. Miller, Herbert Xu

> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] crypto: rockchip - drop redundant crypto_skcipher_ivsize() calls
  2025-11-05 14:52 [PATCH] crypto: rockchip - drop redundant crypto_skcipher_ivsize() calls Karina Yankevich
  2025-11-05 16:55 ` Markus Elfring
@ 2025-11-14 10:20 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2025-11-14 10:20 UTC (permalink / raw)
  To: Karina Yankevich
  Cc: Corentin Labbe, David S. Miller, linux-crypto, linux-rockchip,
	linux-kernel, lvc-project, Sergey Shtylyov

On Wed, Nov 05, 2025 at 05:52:04PM +0300, Karina Yankevich wrote:
> 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")
> Signed-off-by: Karina Yankevich <k.yankevich@omp.ru>
> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> ---
>  drivers/crypto/rockchip/rk3288_crypto_skcipher.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-11-14 10:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-05 14:52 [PATCH] crypto: rockchip - drop redundant crypto_skcipher_ivsize() calls Karina Yankevich
2025-11-05 16:55 ` Markus Elfring
2025-11-14 10:20 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®