diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2022-06-07 01:42:59 +0300 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2022-06-07 23:18:08 +0300 |
commit | 0e3c3b901c00364198d31482fa2552ccf2d5c899 (patch) | |
tree | 183000d0206ce0fc5c925d1f23819988a853b63e /include/linux/uaccess.h | |
parent | f2906aa863381afb0015a9eb7fefad885d4e5a56 (diff) | |
download | linux-0e3c3b901c00364198d31482fa2552ccf2d5c899.tar.xz |
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>
Diffstat (limited to 'include/linux/uaccess.h')
-rw-r--r-- | include/linux/uaccess.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index 5a328cf02b75..47e5d374c7eb 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h @@ -148,7 +148,7 @@ _copy_to_user(void __user *, const void *, unsigned long); static __always_inline unsigned long __must_check copy_from_user(void *to, const void __user *from, unsigned long n) { - if (likely(check_copy_size(to, n, false))) + if (check_copy_size(to, n, false)) n = _copy_from_user(to, from, n); return n; } @@ -156,7 +156,7 @@ copy_from_user(void *to, const void __user *from, unsigned long n) static __always_inline unsigned long __must_check copy_to_user(void __user *to, const void *from, unsigned long n) { - if (likely(check_copy_size(from, n, true))) + if (check_copy_size(from, n, true)) n = _copy_to_user(to, from, n); return n; } |