Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: sun8i-ss - Move j init earlier in sun8i_ss_hash_run

With gcc-14 I get

../drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c: In function ‘sun8i_ss_hash_run’:
../drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c:631:21: warning: ‘j’ may be used uninitialized [-Wmaybe-uninitialized]
631 | j = hash_pad(bf, 4096, j, byte_count, true, bs);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c:493:13: note: ‘j’ was declared here
493 | int j, i, k, todo;
| ^

Fix this false positive by moving the initialisation of j earlier.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

+1 -1
+1 -1
drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c
··· 502 502 503 503 algt = container_of(alg, struct sun8i_ss_alg_template, alg.hash.base); 504 504 ss = algt->ss; 505 + j = 0; 505 506 506 507 digestsize = crypto_ahash_digestsize(tfm); 507 508 if (digestsize == SHA224_DIGEST_SIZE) ··· 537 536 goto err_dma_result; 538 537 } 539 538 540 - j = 0; 541 539 len = areq->nbytes; 542 540 sg = areq->src; 543 541 i = 0;