lkml.org 
[lkml]   [2020]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 1/2] asm-generic/uaccess: don't define inline functions if noinline lib/* in use
Date
There are 2 generic varaints of strncpy_from_user() / strnlen_user()
(1). inline version in asm-generic/uaccess.h
(2). optimized word-at-a-time version in lib/*

This patch disables #1 if #2 selected. This allows arches to continue
reusing asm-generic/uaccess.h for rest of code

This came up when switching ARC to generic word-at-a-time interface

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
---
include/asm-generic/uaccess.h | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
index e935318804f8..2ea7f4e0e60e 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -212,6 +212,7 @@ static inline int __get_user_fn(size_t size, const void __user *ptr, void *x)

extern int __get_user_bad(void) __attribute__((noreturn));

+#ifndef CONFIG_GENERIC_STRNCPY_FROM_USER
/*
* Copy a null terminated string from userspace.
*/
@@ -234,7 +235,11 @@ strncpy_from_user(char *dst, const char __user *src, long count)
return -EFAULT;
return __strncpy_from_user(dst, src, count);
}
+#else
+extern long strncpy_from_user(char *dest, const char __user *src, long count);
+#endif

+#ifndef CONFIG_GENERIC_STRNLEN_USER
/*
* Return the size of a string (including the ending 0)
*
@@ -255,6 +260,9 @@ static inline long strnlen_user(const char __user *src, long n)
return 0;
return __strnlen_user(src, n);
}
+#else
+extern __must_check long strnlen_user(const char __user *str, long n);
+#endif

/*
* Zero Userspace
--
2.20.1
\
 
 \ /
  Last update: 2020-01-16 01:22    [W:0.036 / U:3.556 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site