Skip to content

Commit 226d44a

Browse files
author
Peter Zijlstra
committed
lib/strn*,objtool: Enforce user_access_begin() rules
Apparently GCC can fail to inline a 'static inline' single caller function: lib/strnlen_user.o: warning: objtool: strnlen_user()+0x33: call to do_strnlen_user() with UACCESS enabled lib/strncpy_from_user.o: warning: objtool: strncpy_from_user()+0x33: call to do_strncpy_from_user() with UACCESS enabled Reported-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Link: https://lore.kernel.org/r/20220408094718.262932488@infradead.org
1 parent 610abf3 commit 226d44a

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

lib/strncpy_from_user.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* hit it), 'max' is the address space maximum (and we return
2626
* -EFAULT if we hit it).
2727
*/
28-
static inline long do_strncpy_from_user(char *dst, const char __user *src,
28+
static __always_inline long do_strncpy_from_user(char *dst, const char __user *src,
2929
unsigned long count, unsigned long max)
3030
{
3131
const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS;

lib/strnlen_user.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* if it fits in a aligned 'long'. The caller needs to check
2121
* the return value against "> max".
2222
*/
23-
static inline long do_strnlen_user(const char __user *src, unsigned long count, unsigned long max)
23+
static __always_inline long do_strnlen_user(const char __user *src, unsigned long count, unsigned long max)
2424
{
2525
const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS;
2626
unsigned long align, res = 0;

0 commit comments

Comments
 (0)