aboutsummaryrefslogtreecommitdiff
path: root/crypto/xcbc.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-03-17 23:44:31 -0700
committerDavid S. Miller <davem@davemloft.net>2008-03-17 23:44:31 -0700
commit2f633928cbba8a5858bb39b11e7219a41b0fbef5 (patch)
tree9a82f4b7f2c3afe4b0208d8e44ea61bae90a7d22 /crypto/xcbc.c
parent5e226e4d9016daee170699f8a4188a5505021756 (diff)
parentbde4f8fa8db2abd5ac9c542d76012d0fedab050f (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'crypto/xcbc.c')
-rw-r--r--crypto/xcbc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/crypto/xcbc.c b/crypto/xcbc.c
index 86727403e5a..2feb0f239c3 100644
--- a/crypto/xcbc.c
+++ b/crypto/xcbc.c
@@ -124,6 +124,11 @@ static int crypto_xcbc_digest_update2(struct hash_desc *pdesc,
unsigned int offset = sg[i].offset;
unsigned int slen = sg[i].length;
+ if (unlikely(slen > nbytes))
+ slen = nbytes;
+
+ nbytes -= slen;
+
while (slen > 0) {
unsigned int len = min(slen, ((unsigned int)(PAGE_SIZE)) - offset);
char *p = crypto_kmap(pg, 0) + offset;
@@ -177,7 +182,6 @@ static int crypto_xcbc_digest_update2(struct hash_desc *pdesc,
offset = 0;
pg++;
}
- nbytes-=sg[i].length;
i++;
} while (nbytes>0);