linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] crypto: pcbc: remove redundant assignment to nbytes
@ 2024-01-16 10:43 Colin Ian King
  2024-01-26  9:03 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2024-01-16 10:43 UTC (permalink / raw)
  To: Herbert Xu, David S . Miller, linux-crypto; +Cc: kernel-janitors, linux-kernel

The assignment to nbytes is redundant, the while loop needs
to just refer to the value in walk.nbytes and the value of
nbytes is being re-assigned inside the loop on both paths
of the following if-statement.  Remove redundant assignment.

Cleans up clang scan build warning:
warning: Although the value stored to 'nbytes' is used in
the enclosing expression, the value is never actually read
from 'nbytes' [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 crypto/pcbc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/crypto/pcbc.c b/crypto/pcbc.c
index 7030f59e46b6..ab469ba50c13 100644
--- a/crypto/pcbc.c
+++ b/crypto/pcbc.c
@@ -71,7 +71,7 @@ static int crypto_pcbc_encrypt(struct skcipher_request *req)
 
 	err = skcipher_walk_virt(&walk, req, false);
 
-	while ((nbytes = walk.nbytes)) {
+	while (walk.nbytes) {
 		if (walk.src.virt.addr == walk.dst.virt.addr)
 			nbytes = crypto_pcbc_encrypt_inplace(req, &walk,
 							     cipher);
@@ -138,7 +138,7 @@ static int crypto_pcbc_decrypt(struct skcipher_request *req)
 
 	err = skcipher_walk_virt(&walk, req, false);
 
-	while ((nbytes = walk.nbytes)) {
+	while (walk.nbytes) {
 		if (walk.src.virt.addr == walk.dst.virt.addr)
 			nbytes = crypto_pcbc_decrypt_inplace(req, &walk,
 							     cipher);
-- 
2.39.2


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

* Re: [PATCH][next] crypto: pcbc: remove redundant assignment to nbytes
  2024-01-16 10:43 [PATCH][next] crypto: pcbc: remove redundant assignment to nbytes Colin Ian King
@ 2024-01-26  9:03 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2024-01-26  9:03 UTC (permalink / raw)
  To: Colin Ian King
  Cc: David S . Miller, linux-crypto, kernel-janitors, linux-kernel

On Tue, Jan 16, 2024 at 10:43:02AM +0000, Colin Ian King wrote:
> The assignment to nbytes is redundant, the while loop needs
> to just refer to the value in walk.nbytes and the value of
> nbytes is being re-assigned inside the loop on both paths
> of the following if-statement.  Remove redundant assignment.
> 
> Cleans up clang scan build warning:
> warning: Although the value stored to 'nbytes' is used in
> the enclosing expression, the value is never actually read
> from 'nbytes' [deadcode.DeadStores]
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  crypto/pcbc.c | 4 ++--
>  1 file changed, 2 insertions(+), 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] 2+ messages in thread

end of thread, other threads:[~2024-01-26  9:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-16 10:43 [PATCH][next] crypto: pcbc: remove redundant assignment to nbytes Colin Ian King
2024-01-26  9:03 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).