diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2022-07-29 20:01:57 +0300 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2022-11-25 21:01:20 +0300 |
commit | 40a86061a5619da8b2840efe1b26696077785cf1 (patch) | |
tree | 434a112c0f91b786c748e5116bf0274b833b89ae /lib | |
parent | eb7081409f94a9a8608593d0fb63a1aa3d6f95d8 (diff) | |
download | linux-40a86061a5619da8b2840efe1b26696077785cf1.tar.xz |
get rid of unlikely() on page_copy_sane() calls
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/iov_iter.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/iov_iter.c b/lib/iov_iter.c index c3ca28ca68a6..e9a8fc9ee8ee 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -703,17 +703,16 @@ static inline bool page_copy_sane(struct page *page, size_t offset, size_t n) head = compound_head(page); v += (page - head) << PAGE_SHIFT; - if (likely(n <= v && v <= (page_size(head)))) - return true; - WARN_ON(1); - return false; + if (WARN_ON(n > v || v > page_size(head))) + return false; + return true; } size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes, struct iov_iter *i) { size_t res = 0; - if (unlikely(!page_copy_sane(page, offset, bytes))) + if (!page_copy_sane(page, offset, bytes)) return 0; if (unlikely(iov_iter_is_pipe(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 struct iov_iter *i) { 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); return 0; } |