diff mbox series

crypto: skcipher - remove unnecessary setting of walk->nbytes

Message ID 20180723172129.91742-1-ebiggers3@gmail.com (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series crypto: skcipher - remove unnecessary setting of walk->nbytes | expand

Commit Message

Eric Biggers July 23, 2018, 5:21 p.m. UTC
From: Eric Biggers <ebiggers@google.com>

Setting 'walk->nbytes = walk->total' in skcipher_walk_first() doesn't
make sense because actually walk->nbytes needs to be set to the length
of the first step in the walk, which may be less than walk->total.  This
is done by skcipher_walk_next() which is called immediately afterwards.
Also walk->nbytes was already set to 0 in skcipher_walk_skcipher(),
which is a better default value in case it's forgotten to be set later.

Therefore, remove the unnecessary assignment to walk->nbytes.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 crypto/skcipher.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Herbert Xu Aug. 3, 2018, 1:59 p.m. UTC | #1
On Mon, Jul 23, 2018 at 10:21:29AM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> Setting 'walk->nbytes = walk->total' in skcipher_walk_first() doesn't
> make sense because actually walk->nbytes needs to be set to the length
> of the first step in the walk, which may be less than walk->total.  This
> is done by skcipher_walk_next() which is called immediately afterwards.
> Also walk->nbytes was already set to 0 in skcipher_walk_skcipher(),
> which is a better default value in case it's forgotten to be set later.
> 
> Therefore, remove the unnecessary assignment to walk->nbytes.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>

Patch applied.  Thanks.
diff mbox series

Patch

diff --git a/crypto/skcipher.c b/crypto/skcipher.c
index 7d6a49fe3047..9f7d229827b5 100644
--- a/crypto/skcipher.c
+++ b/crypto/skcipher.c
@@ -436,7 +436,6 @@  static int skcipher_walk_first(struct skcipher_walk *walk)
 	}
 
 	walk->page = NULL;
-	walk->nbytes = walk->total;
 
 	return skcipher_walk_next(walk);
 }