Browse Source

crypto: scatterwalk - Fix scatterwalk_done() test

We are done with the scattergather entry when the walk offset goes
past sg->offset + sg->length, not when it crosses a page boundary.

There is a similarly queer test in the second half of
scatterwalk_pagedone() that probably needs some scrutiny.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
David S. Miller 15 years ago
parent
commit
85c6201a80
1 changed files with 1 additions and 1 deletions
  1. 1 1
      crypto/scatterwalk.c

+ 1 - 1
crypto/scatterwalk.c

@@ -68,7 +68,7 @@ static void scatterwalk_pagedone(struct scatter_walk *walk, int out,
 
 
 void scatterwalk_done(struct scatter_walk *walk, int out, int more)
 void scatterwalk_done(struct scatter_walk *walk, int out, int more)
 {
 {
-	if (!offset_in_page(walk->offset) || !more)
+	if (!(scatterwalk_pagelen(walk) & (PAGE_SIZE - 1)) || !more)
 		scatterwalk_pagedone(walk, out, more);
 		scatterwalk_pagedone(walk, out, more);
 }
 }
 EXPORT_SYMBOL_GPL(scatterwalk_done);
 EXPORT_SYMBOL_GPL(scatterwalk_done);