diff options
author | Kees Cook <keescook@chromium.org> | 2016-08-31 16:04:21 -0700 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2016-09-06 12:17:29 -0700 |
commit | 81409e9e28058811c9ea865345e1753f8f677e44 (patch) | |
tree | 6573d95f94ea5b164035a9527a60d08650c29329 /include/linux/thread_info.h | |
parent | e6971009a95a74f28c58bbae415c40effad1226c (diff) | |
download | lwn-81409e9e28058811c9ea865345e1753f8f677e44.tar.gz lwn-81409e9e28058811c9ea865345e1753f8f677e44.zip |
usercopy: fold builtin_const check into inline function
Instead of having each caller of check_object_size() need to remember to
check for a const size parameter, move the check into check_object_size()
itself. This actually matches the original implementation in PaX, though
this commit cleans up the now-redundant builtin_const() calls in the
various architectures.
Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'include/linux/thread_info.h')
-rw-r--r-- | include/linux/thread_info.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h index cbd8990e2e77..10c9e601398b 100644 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h @@ -121,7 +121,8 @@ extern void __check_object_size(const void *ptr, unsigned long n, static inline void check_object_size(const void *ptr, unsigned long n, bool to_user) { - __check_object_size(ptr, n, to_user); + if (!__builtin_constant_p(n)) + __check_object_size(ptr, n, to_user); } #else static inline void check_object_size(const void *ptr, unsigned long n, |