UPSTREAM: usercopy: force check_object_size() inline
authorKees Cook <keescook@chromium.org>
Wed, 7 Sep 2016 16:39:32 +0000 (09:39 -0700)
committerAmit Pundir <amit.pundir@linaro.org>
Wed, 14 Sep 2016 09:14:29 +0000 (14:44 +0530)
Just for good measure, make sure that check_object_size() is always
inlined too, as already done for copy_*_user() and __copy_*_user().

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Change-Id: Ibfdf4790d03fe426e68d9a864c55a0d1bbfb7d61
(cherry picked from commit a85d6b8242dc78ef3f4542a0f979aebcbe77fc4e)
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
include/linux/thread_info.h

index eded095fe81e5c3ddc04e2af91f5bdaf9e4d28a5..4cf89517783ab8e4a56a71ea6e88646427c74aa9 100644 (file)
@@ -158,8 +158,8 @@ static inline int arch_within_stack_frames(const void * const stack,
 extern void __check_object_size(const void *ptr, unsigned long n,
                                        bool to_user);
 
-static inline void check_object_size(const void *ptr, unsigned long n,
-                                    bool to_user)
+static __always_inline void check_object_size(const void *ptr, unsigned long n,
+                                             bool to_user)
 {
        if (!__builtin_constant_p(n))
                __check_object_size(ptr, n, to_user);