aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/scatterwalk.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/scatterwalk.c')
-rw-r--r--crypto/scatterwalk.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c
index 35172d3f043b..81afd1790a1d 100644
--- a/crypto/scatterwalk.c
+++ b/crypto/scatterwalk.c
@@ -59,8 +59,12 @@ EXPORT_SYMBOL_GPL(scatterwalk_map);
59static void scatterwalk_pagedone(struct scatter_walk *walk, int out, 59static void scatterwalk_pagedone(struct scatter_walk *walk, int out,
60 unsigned int more) 60 unsigned int more)
61{ 61{
62 if (out) 62 if (out) {
63 flush_dcache_page(scatterwalk_page(walk)); 63 struct page *page;
64
65 page = walk->sg->page + ((walk->offset - 1) >> PAGE_SHIFT);
66 flush_dcache_page(page);
67 }
64 68
65 if (more) { 69 if (more) {
66 walk->offset += PAGE_SIZE - 1; 70 walk->offset += PAGE_SIZE - 1;
@@ -91,6 +95,8 @@ void scatterwalk_copychunks(void *buf, struct scatter_walk *walk,
91 memcpy_dir(buf, vaddr, len_this_page, out); 95 memcpy_dir(buf, vaddr, len_this_page, out);
92 scatterwalk_unmap(vaddr, out); 96 scatterwalk_unmap(vaddr, out);
93 97
98 scatterwalk_advance(walk, len_this_page);
99
94 if (nbytes == len_this_page) 100 if (nbytes == len_this_page)
95 break; 101 break;
96 102
@@ -99,7 +105,5 @@ void scatterwalk_copychunks(void *buf, struct scatter_walk *walk,
99 105
100 scatterwalk_pagedone(walk, out, 1); 106 scatterwalk_pagedone(walk, out, 1);
101 } 107 }
102
103 scatterwalk_advance(walk, nbytes);
104} 108}
105EXPORT_SYMBOL_GPL(scatterwalk_copychunks); 109EXPORT_SYMBOL_GPL(scatterwalk_copychunks);