mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
No need of likely/unlikely on calls of check_copy_size()
it's inline and unlikely() inside of it (including the implicit one in WARN_ON_ONCE()) suffice to convince the compiler that getting false from check_copy_size() is unlikely. Spotted-by: Jens Axboe <axboe@kernel.dk> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -156,19 +156,17 @@ static inline size_t copy_folio_to_iter(struct folio *folio, size_t offset,
|
||||
static __always_inline __must_check
|
||||
size_t copy_to_iter(const void *addr, size_t bytes, struct iov_iter *i)
|
||||
{
|
||||
if (unlikely(!check_copy_size(addr, bytes, true)))
|
||||
return 0;
|
||||
else
|
||||
if (check_copy_size(addr, bytes, true))
|
||||
return _copy_to_iter(addr, bytes, i);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __always_inline __must_check
|
||||
size_t copy_from_iter(void *addr, size_t bytes, struct iov_iter *i)
|
||||
{
|
||||
if (unlikely(!check_copy_size(addr, bytes, false)))
|
||||
return 0;
|
||||
else
|
||||
if (check_copy_size(addr, bytes, false))
|
||||
return _copy_from_iter(addr, bytes, i);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __always_inline __must_check
|
||||
@@ -184,10 +182,9 @@ bool copy_from_iter_full(void *addr, size_t bytes, struct iov_iter *i)
|
||||
static __always_inline __must_check
|
||||
size_t copy_from_iter_nocache(void *addr, size_t bytes, struct iov_iter *i)
|
||||
{
|
||||
if (unlikely(!check_copy_size(addr, bytes, false)))
|
||||
return 0;
|
||||
else
|
||||
if (check_copy_size(addr, bytes, false))
|
||||
return _copy_from_iter_nocache(addr, bytes, i);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __always_inline __must_check
|
||||
|
||||
Reference in New Issue
Block a user