diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-08-04 04:26:03 +0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-08-04 04:26:03 +0400 |
commit | 412a4ac5e9cf7fdeb6af562c25547a9b9da7674f (patch) | |
tree | a8ce13cbc9c47c99799e5e3e3ad26ba78274ee73 /drivers/crypto/talitos.c | |
parent | e8e5c2155b0035b6e04f29be67f6444bc914005b (diff) | |
parent | 0c2daaafcdec726e89cbccca61d576de8429c537 (diff) | |
download | linux-412a4ac5e9cf7fdeb6af562c25547a9b9da7674f.tar.xz |
Merge commit 'gcl/next' into next
Diffstat (limited to 'drivers/crypto/talitos.c')
-rw-r--r-- | drivers/crypto/talitos.c | 6 |
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; |