From: Herbert Xu Date: Thu, 13 Dec 2007 16:44:11 +0000 (+0800) Subject: [CRYPTO] scatterwalk: Handle zero nbytes in scatterwalk_map_and_copy X-Git-Tag: v2.6.25-rc1~1242^2~18 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=6e050778c5d08a97d5d98f7cb62bc503e872615c;p=linux-2.6-omap-h63xx.git [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 --- diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c index 297e19d13c4..9aeeb52004a 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);