summaryrefslogtreecommitdiff
path: root/arch/hexagon
diff options
context:
space:
mode:
Diffstat (limited to 'arch/hexagon')
-rw-r--r--arch/hexagon/include/asm/uaccess.h22
1 files changed, 13 insertions, 9 deletions
diff --git a/arch/hexagon/include/asm/uaccess.h b/arch/hexagon/include/asm/uaccess.h
index c1019a736ff1..59aa3a50744f 100644
--- a/arch/hexagon/include/asm/uaccess.h
+++ b/arch/hexagon/include/asm/uaccess.h
@@ -57,23 +57,27 @@ unsigned long raw_copy_to_user(void __user *to, const void *from,
__kernel_size_t __clear_user_hexagon(void __user *dest, unsigned long count);
#define __clear_user(a, s) __clear_user_hexagon((a), (s))
-#define __strncpy_from_user(dst, src, n) hexagon_strncpy_from_user(dst, src, n)
+extern long __strnlen_user(const char __user *src, long n);
-/* get around the ifndef in asm-generic/uaccess.h */
-#define __strnlen_user __strnlen_user
+static inline strnlen_user(const char __user *src, long n)
+{
+ if (!access_ok(src, 1))
+ return 0;
-extern long __strnlen_user(const char __user *src, long n);
+ return __strnlen_user(src, n);
+}
+/* get around the ifndef in asm-generic/uaccess.h */
+#define strnlen_user strnlen_user
-static inline long hexagon_strncpy_from_user(char *dst, const char __user *src,
- long n);
+static inline long strncpy_from_user(char *dst, const char __user *src, long n);
+#define strncpy_from_user strncpy_from_user
#include <asm-generic/uaccess.h>
/* Todo: an actual accelerated version of this. */
-static inline long hexagon_strncpy_from_user(char *dst, const char __user *src,
- long n)
+static inline long strncpy_from_user(char *dst, const char __user *src, long n)
{
- long res = __strnlen_user(src, n);
+ long res = strnlen_user(src, n);
if (unlikely(!res))
return -EFAULT;