[PATCH] uml: fix access_ok
[linux-2.6.22.y-op.git] / arch / um / kernel / tt / uaccess.c
blob1cb60726567ed43da205922b9b004fcd42be8a7b
1 /*
2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
6 #include "linux/sched.h"
7 #include "asm/uaccess.h"
9 int copy_from_user_tt(void *to, const void __user *from, int n)
11 if(!access_ok(VERIFY_READ, from, n))
12 return(n);
14 return(__do_copy_from_user(to, from, n, &current->thread.fault_addr,
15 &current->thread.fault_catcher));
18 int copy_to_user_tt(void __user *to, const void *from, int n)
20 if(!access_ok(VERIFY_WRITE, to, n))
21 return(n);
23 return(__do_copy_to_user(to, from, n, &current->thread.fault_addr,
24 &current->thread.fault_catcher));
27 int strncpy_from_user_tt(char *dst, const char __user *src, int count)
29 int n;
31 if(!access_ok(VERIFY_READ, src, 1))
32 return(-EFAULT);
34 n = __do_strncpy_from_user(dst, src, count,
35 &current->thread.fault_addr,
36 &current->thread.fault_catcher);
37 if(n < 0) return(-EFAULT);
38 return(n);
41 int __clear_user_tt(void __user *mem, int len)
43 return(__do_clear_user(mem, len,
44 &current->thread.fault_addr,
45 &current->thread.fault_catcher));
48 int clear_user_tt(void __user *mem, int len)
50 if(!access_ok(VERIFY_WRITE, mem, len))
51 return(len);
53 return(__do_clear_user(mem, len, &current->thread.fault_addr,
54 &current->thread.fault_catcher));
57 int strnlen_user_tt(const void __user *str, int len)
59 return(__do_strnlen_user(str, len,
60 &current->thread.fault_addr,
61 &current->thread.fault_catcher));
65 * Overrides for Emacs so that we follow Linus's tabbing style.
66 * Emacs will notice this stuff at the end of the file and automatically
67 * adjust the settings for this buffer only. This must remain at the end
68 * of the file.
69 * ---------------------------------------------------------------------------
70 * Local variables:
71 * c-file-style: "linux"
72 * End: