Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / crypto / scatterwalk.c
index 50c9461..2953e2c 100644 (file)
@@ -17,7 +17,6 @@
 #include <linux/mm.h>
 #include <linux/pagemap.h>
 #include <linux/highmem.h>
-#include <asm/bug.h>
 #include <asm/scatterlist.h>
 #include "internal.h"
 #include "scatterwalk.h"
@@ -100,7 +99,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 +107,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;