Commit 40a86061 authored by Al Viro's avatar Al Viro

get rid of unlikely() on page_copy_sane() calls

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent eb708140
...@@ -703,17 +703,16 @@ static inline bool page_copy_sane(struct page *page, size_t offset, size_t n) ...@@ -703,17 +703,16 @@ static inline bool page_copy_sane(struct page *page, size_t offset, size_t n)
head = compound_head(page); head = compound_head(page);
v += (page - head) << PAGE_SHIFT; v += (page - head) << PAGE_SHIFT;
if (likely(n <= v && v <= (page_size(head)))) if (WARN_ON(n > v || v > page_size(head)))
return true;
WARN_ON(1);
return false; return false;
return true;
} }
size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes, size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes,
struct iov_iter *i) struct iov_iter *i)
{ {
size_t res = 0; size_t res = 0;
if (unlikely(!page_copy_sane(page, offset, bytes))) if (!page_copy_sane(page, offset, bytes))
return 0; return 0;
if (unlikely(iov_iter_is_pipe(i))) if (unlikely(iov_iter_is_pipe(i)))
return copy_page_to_iter_pipe(page, offset, bytes, i); return copy_page_to_iter_pipe(page, offset, bytes, i);
...@@ -808,7 +807,7 @@ size_t copy_page_from_iter_atomic(struct page *page, unsigned offset, size_t byt ...@@ -808,7 +807,7 @@ size_t copy_page_from_iter_atomic(struct page *page, unsigned offset, size_t byt
struct iov_iter *i) struct iov_iter *i)
{ {
char *kaddr = kmap_atomic(page), *p = kaddr + offset; char *kaddr = kmap_atomic(page), *p = kaddr + offset;
if (unlikely(!page_copy_sane(page, offset, bytes))) { if (!page_copy_sane(page, offset, bytes)) {
kunmap_atomic(kaddr); kunmap_atomic(kaddr);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment