diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-12-13 17:44:11 +0100 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2008-01-10 22:16:54 +0100 |
commit | 6e050778c5d08a97d5d98f7cb62bc503e872615c (patch) | |
tree | b58022ec4378bbfb51291c68da914ce64a526db8 /crypto/scatterwalk.c | |
parent | [CRYPTO] null: Allow setkey on digest_null (diff) | |
download | linux-6e050778c5d08a97d5d98f7cb62bc503e872615c.tar.xz linux-6e050778c5d08a97d5d98f7cb62bc503e872615c.zip |
[CRYPTO] scatterwalk: Handle zero nbytes in scatterwalk_map_and_copy
It's better to return silently than crash and burn when someone feeds us
a zero length. In particular the null digest algorithm when used as part
of authenc will do that to us.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/scatterwalk.c')
-rw-r--r-- | crypto/scatterwalk.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c index 297e19d13c4e..9aeeb52004a5 100644 --- a/crypto/scatterwalk.c +++ b/crypto/scatterwalk.c @@ -105,6 +105,9 @@ void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg, struct scatter_walk walk; unsigned int offset = 0; + if (!nbytes) + return; + for (;;) { scatterwalk_start(&walk, sg); |