Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit db68ce10 authored by Al Viro's avatar Al Viro
Browse files

new helper: uaccess_kernel()



Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent aaa2e7ac
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -425,7 +425,7 @@ clear_user(void __user *to, long len)
#undef __module_call

#define user_addr_max() \
        (segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL)
        (uaccess_kernel() ? ~0UL : TASK_SIZE)

extern long strncpy_from_user(char *dest, const char __user *src, long count);
extern __must_check long strlen_user(const char __user *str);
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@
#include <linux/string.h>	/* for generic string functions */


#define __kernel_ok		(segment_eq(get_fs(), KERNEL_DS))
#define __kernel_ok		(uaccess_kernel())

/*
 * Algorithmically, for __user_ok() we want do:
+1 −1
Original line number Diff line number Diff line
@@ -266,7 +266,7 @@ static inline void set_fs(mm_segment_t fs)
#define access_ok(type, addr, size)	(__range_ok(addr, size) == 0)

#define user_addr_max() \
	(segment_eq(get_fs(), KERNEL_DS) ? ~0UL : get_fs())
	(uaccess_kernel() ? ~0UL : get_fs())

/*
 * The "__xxx" versions of the user access functions do not verify the
+2 −2
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n)
	unsigned long ua_flags;
	int atomic;

	if (unlikely(segment_eq(get_fs(), KERNEL_DS))) {
	if (uaccess_kernel()) {
		memcpy((void *)to, from, n);
		return 0;
	}
@@ -162,7 +162,7 @@ __clear_user_memset(void __user *addr, unsigned long n)
{
	unsigned long ua_flags;

	if (unlikely(segment_eq(get_fs(), KERNEL_DS))) {
	if (uaccess_kernel()) {
		memset((void *)addr, 0, n);
		return 0;
	}
+1 −1
Original line number Diff line number Diff line
@@ -370,7 +370,7 @@ int _access_ok(unsigned long addr, unsigned long size)
	/* Check that things do not wrap around */
	if (addr > ULONG_MAX - size)
		return 0;
	if (segment_eq(get_fs(), KERNEL_DS))
	if (uaccess_kernel())
		return 1;
#ifdef CONFIG_MTD_UCLINUX
	if (1)
Loading