Merge branch 'e1000-fixes' of git://198.78.49.142/~jbrandeb/linux-2.6
[pandora-kernel.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;