mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
new helper: uaccess_kernel()
Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
parent
aaa2e7ac80
commit
db68ce10c4
32 changed files with 44 additions and 42 deletions
|
|
@ -45,7 +45,7 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
|
|||
return __addr_range_nowrap(addr, size) &&
|
||||
(__under_task_size(addr, size) ||
|
||||
__access_ok_vsyscall(addr, size) ||
|
||||
segment_eq(get_fs(), KERNEL_DS));
|
||||
uaccess_kernel());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ static int copy_chunk_from_user(unsigned long from, int len, void *arg)
|
|||
|
||||
long __copy_from_user(void *to, const void __user *from, unsigned long n)
|
||||
{
|
||||
if (segment_eq(get_fs(), KERNEL_DS)) {
|
||||
if (uaccess_kernel()) {
|
||||
memcpy(to, (__force void*)from, n);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ static int copy_chunk_to_user(unsigned long to, int len, void *arg)
|
|||
|
||||
long __copy_to_user(void __user *to, const void *from, unsigned long n)
|
||||
{
|
||||
if (segment_eq(get_fs(), KERNEL_DS)) {
|
||||
if (uaccess_kernel()) {
|
||||
memcpy((__force void *) to, from, n);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -189,7 +189,7 @@ long __strncpy_from_user(char *dst, const char __user *src, long count)
|
|||
long n;
|
||||
char *ptr = dst;
|
||||
|
||||
if (segment_eq(get_fs(), KERNEL_DS)) {
|
||||
if (uaccess_kernel()) {
|
||||
strncpy(dst, (__force void *) src, count);
|
||||
return strnlen(dst, count);
|
||||
}
|
||||
|
|
@ -210,7 +210,7 @@ static int clear_chunk(unsigned long addr, int len, void *unused)
|
|||
|
||||
unsigned long __clear_user(void __user *mem, unsigned long len)
|
||||
{
|
||||
if (segment_eq(get_fs(), KERNEL_DS)) {
|
||||
if (uaccess_kernel()) {
|
||||
memset((__force void*)mem, 0, len);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -235,7 +235,7 @@ long __strnlen_user(const void __user *str, long len)
|
|||
{
|
||||
int count = 0, n;
|
||||
|
||||
if (segment_eq(get_fs(), KERNEL_DS))
|
||||
if (uaccess_kernel())
|
||||
return strnlen((__force char*)str, len) + 1;
|
||||
|
||||
n = buffer_op((unsigned long) str, len, 0, strnlen_chunk, &count);
|
||||
|
|
|
|||
Loading…
Reference in a new issue