summaryrefslogtreecommitdiff
path: root/crypto/scatterwalk.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/scatterwalk.c')
-rw-r--r--crypto/scatterwalk.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c
index 50c9461e8cc6..47ac90e615f4 100644
--- a/crypto/scatterwalk.c
+++ b/crypto/scatterwalk.c
@@ -100,7 +100,7 @@ void scatterwalk_done(struct scatter_walk *walk, int out, int more)
int scatterwalk_copychunks(void *buf, struct scatter_walk *walk,
size_t nbytes, int out)
{
- do {
+ while (nbytes > walk->len_this_page) {
memcpy_dir(buf, walk->data, walk->len_this_page, out);
buf += walk->len_this_page;
nbytes -= walk->len_this_page;
@@ -108,7 +108,7 @@ int scatterwalk_copychunks(void *buf, struct scatter_walk *walk,
scatterwalk_unmap(walk, out);
scatterwalk_pagedone(walk, out, 1);
scatterwalk_map(walk, out);
- } while (nbytes > walk->len_this_page);
+ }
memcpy_dir(buf, walk->data, nbytes, out);
return nbytes;