Linux-csky Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] asm-generic: uaccess.h: Fixup GENERIC_STRNCPY_FROM_USER & STRNLEN_USER
@ 2021-04-21  9:04 guoren
  0 siblings, 0 replies; only message in thread
From: guoren @ 2021-04-21  9:04 UTC (permalink / raw)
  To: guoren, arnd; +Cc: linux-kernel, linux-csky, linux-arch, Guo Ren

From: Guo Ren <guoren@linux.alibaba.com>

When arch include asm-generic/uaccess.h and enable GENERIC
STRNCPY_FROM_USER / STRNLEN_USER. Then, compile error.

Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Cc: Arnd Bergmann <arnd@arndb.de>
---
 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 4973328..c02080d 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -243,6 +243,9 @@ static inline int __get_user_fn(size_t size, const void __user *ptr, void *x)
 
 extern int __get_user_bad(void) __attribute__((noreturn));
 
+#ifdef CONFIG_GENERIC_STRNCPY_FROM_USER
+long strncpy_from_user(char *dst, const char __user *src, long count);
+#else
 /*
  * Copy a null terminated string from userspace.
  */
@@ -265,7 +268,11 @@ strncpy_from_user(char *dst, const char __user *src, long count)
 		return -EFAULT;
 	return __strncpy_from_user(dst, src, count);
 }
+#endif /* CONFIG_GENERIC_STRNCPY_FROM_USER */
 
+#ifdef CONFIG_GENERIC_STRNLEN_USER
+long strnlen_user(const char __user *src, long n);
+#else
 /*
  * Return the size of a string (including the ending 0)
  *
@@ -286,6 +293,7 @@ static inline long strnlen_user(const char __user *src, long n)
 		return 0;
 	return __strnlen_user(src, n);
 }
+#endif /* CONFIG_GENERIC_STRNLEN_USER */
 
 /*
  * Zero Userspace
-- 
2.7.4


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21  9:04 [PATCH] asm-generic: uaccess.h: Fixup GENERIC_STRNCPY_FROM_USER & STRNLEN_USER guoren

Linux-csky Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-csky/0 linux-csky/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-csky linux-csky/ https://lore.kernel.org/linux-csky \
		linux-csky@vger.kernel.org
	public-inbox-index linux-csky

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-csky


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git