mirror of https://github.com/torvalds/linux.git
crypto: skcipher - remove redundant clamping to page size
In the case where skcipher_walk_next() allocates a bounce page, that page by definition has size PAGE_SIZE. The number of bytes to copy 'n' is guaranteed to fit in it, since earlier in the function it was clamped to be at most a page. Therefore remove the unnecessary logic that tried to clamp 'n' again to fit in the bounce page. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
807c8018f5
commit
a22a2316be
|
|
@ -250,6 +250,7 @@ static int skcipher_walk_next(struct skcipher_walk *walk)
|
||||||
slow_path:
|
slow_path:
|
||||||
return skcipher_next_slow(walk, bsize);
|
return skcipher_next_slow(walk, bsize);
|
||||||
}
|
}
|
||||||
|
walk->nbytes = n;
|
||||||
|
|
||||||
if (unlikely((walk->in.offset | walk->out.offset) & walk->alignmask)) {
|
if (unlikely((walk->in.offset | walk->out.offset) & walk->alignmask)) {
|
||||||
if (!walk->page) {
|
if (!walk->page) {
|
||||||
|
|
@ -259,15 +260,10 @@ static int skcipher_walk_next(struct skcipher_walk *walk)
|
||||||
if (!walk->page)
|
if (!walk->page)
|
||||||
goto slow_path;
|
goto slow_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
walk->nbytes = min_t(unsigned, n,
|
|
||||||
PAGE_SIZE - offset_in_page(walk->page));
|
|
||||||
walk->flags |= SKCIPHER_WALK_COPY;
|
walk->flags |= SKCIPHER_WALK_COPY;
|
||||||
return skcipher_next_copy(walk);
|
return skcipher_next_copy(walk);
|
||||||
}
|
}
|
||||||
|
|
||||||
walk->nbytes = n;
|
|
||||||
|
|
||||||
return skcipher_next_fast(walk);
|
return skcipher_next_fast(walk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue