diff options
| -rw-r--r-- | .clang-format | 1 | ||||
| -rw-r--r-- | include/linux/uio.h | 8 | ||||
| -rw-r--r-- | lib/iov_iter.c | 17 |
3 files changed, 15 insertions, 11 deletions
diff --git a/.clang-format b/.clang-format index 201a4f531b90..f49620f506f1 100644 --- a/.clang-format +++ b/.clang-format | |||
| @@ -290,7 +290,6 @@ ForEachMacros: | |||
| 290 | - 'idr_for_each_entry_ul' | 290 | - 'idr_for_each_entry_ul' |
| 291 | - 'inet_bind_bucket_for_each' | 291 | - 'inet_bind_bucket_for_each' |
| 292 | - 'inet_lhash2_for_each_icsk_rcu' | 292 | - 'inet_lhash2_for_each_icsk_rcu' |
| 293 | - 'iov_for_each' | ||
| 294 | - 'key_for_each' | 293 | - 'key_for_each' |
| 295 | - 'key_for_each_safe' | 294 | - 'key_for_each_safe' |
| 296 | - 'klp_for_each_func' | 295 | - 'klp_for_each_func' |
diff --git a/include/linux/uio.h b/include/linux/uio.h index ecf584f6b82d..87477e1640f9 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h | |||
| @@ -110,14 +110,6 @@ static inline struct iovec iov_iter_iovec(const struct iov_iter *iter) | |||
| 110 | }; | 110 | }; |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | #define iov_for_each(iov, iter, start) \ | ||
| 114 | if (iov_iter_type(start) == ITER_IOVEC || \ | ||
| 115 | iov_iter_type(start) == ITER_KVEC) \ | ||
| 116 | for (iter = (start); \ | ||
| 117 | (iter).count && \ | ||
| 118 | ((iov = iov_iter_iovec(&(iter))), 1); \ | ||
| 119 | iov_iter_advance(&(iter), (iov).iov_len)) | ||
| 120 | |||
| 121 | size_t iov_iter_copy_from_user_atomic(struct page *page, | 113 | size_t iov_iter_copy_from_user_atomic(struct page *page, |
| 122 | struct iov_iter *i, unsigned long offset, size_t bytes); | 114 | struct iov_iter *i, unsigned long offset, size_t bytes); |
| 123 | void iov_iter_advance(struct iov_iter *i, size_t bytes); | 115 | void iov_iter_advance(struct iov_iter *i, size_t bytes); |
diff --git a/lib/iov_iter.c b/lib/iov_iter.c index be4bd627caf0..ea36dc355da1 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c | |||
| @@ -861,8 +861,21 @@ EXPORT_SYMBOL(_copy_from_iter_full_nocache); | |||
| 861 | 861 | ||
| 862 | static inline bool page_copy_sane(struct page *page, size_t offset, size_t n) | 862 | static inline bool page_copy_sane(struct page *page, size_t offset, size_t n) |
| 863 | { | 863 | { |
| 864 | struct page *head = compound_head(page); | 864 | struct page *head; |
| 865 | size_t v = n + offset + page_address(page) - page_address(head); | 865 | size_t v = n + offset; |
| 866 | |||
| 867 | /* | ||
| 868 | * The general case needs to access the page order in order | ||
| 869 | * to compute the page size. | ||
| 870 | * However, we mostly deal with order-0 pages and thus can | ||
| 871 | * avoid a possible cache line miss for requests that fit all | ||
| 872 | * page orders. | ||
| 873 | */ | ||
| 874 | if (n <= v && v <= PAGE_SIZE) | ||
| 875 | return true; | ||
| 876 | |||
| 877 | head = compound_head(page); | ||
| 878 | v += (page - head) << PAGE_SHIFT; | ||
| 866 | 879 | ||
| 867 | if (likely(n <= v && v <= (PAGE_SIZE << compound_order(head)))) | 880 | if (likely(n <= v && v <= (PAGE_SIZE << compound_order(head)))) |
| 868 | return true; | 881 | return true; |
