summaryrefslogtreecommitdiff
path: root/drivers/crypto/talitos.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2010-07-26 03:52:21 +0400
committerGrant Likely <grant.likely@secretlab.ca>2010-07-26 03:52:21 +0400
commit5ffdcd94ea0171cf9a3ca63051c2246426103b5b (patch)
treedfa1522796d5af649caf64ac6e2f1e69119e85d0 /drivers/crypto/talitos.c
parentcf40f082f8d3a98e28af02af20d00d2500eb6a65 (diff)
parentb37fa16e78d6f9790462b3181602a26b5af36260 (diff)
downloadlinux-5ffdcd94ea0171cf9a3ca63051c2246426103b5b.tar.xz
Merge commit 'v2.6.35-rc6' into spi/test
Diffstat (limited to 'drivers/crypto/talitos.c')
-rw-r--r--drivers/crypto/talitos.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index 637c105f53d2..bd78acf3c365 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -1183,10 +1183,14 @@ static size_t sg_copy_end_to_buffer(struct scatterlist *sgl, unsigned int nents,
/* Copy part of this segment */
ignore = skip - offset;
len = miter.length - ignore;
+ if (boffset + len > buflen)
+ len = buflen - boffset;
memcpy(buf + boffset, miter.addr + ignore, len);
} else {
- /* Copy all of this segment */
+ /* Copy all of this segment (up to buflen) */
len = miter.length;
+ if (boffset + len > buflen)
+ len = buflen - boffset;
memcpy(buf + boffset, miter.addr, len);
}
boffset += len;