Commit 9f1167272890c210399e6b8a32d7cf7295713f5d

Authored by Herbert Xu
1 parent 4ee531a3e6

[CRYPTO] api: Flush the current page right than the next

On platforms where flush_dcache_page is needed we're currently flushing
the next page right than the one we've just processed.  This patch fixes
the off-by-one error.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Showing 1 changed file with 6 additions and 2 deletions Side-by-side Diff

crypto/scatterwalk.c
... ... @@ -59,8 +59,12 @@
59 59 static void scatterwalk_pagedone(struct scatter_walk *walk, int out,
60 60 unsigned int more)
61 61 {
62   - if (out)
63   - flush_dcache_page(scatterwalk_page(walk));
  62 + if (out) {
  63 + struct page *page;
  64 +
  65 + page = walk->sg->page + ((walk->offset - 1) >> PAGE_SHIFT);
  66 + flush_dcache_page(page);
  67 + }
64 68  
65 69 if (more) {
66 70 walk->offset += PAGE_SIZE - 1;