Skip to content

Commit

Permalink
crypto: pcbc - remove redundant assignment to nbytes
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
ColinIanKing authored and herbertx committed Jan 26, 2024
1 parent 8db78dd commit 1bfde2c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crypto/pcbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 1bfde2c

Please sign in to comment.