X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fum%2Finclude%2Fum_uaccess.h;h=4567f1eeb4a7d25f8d079aa846a752514e7d6340;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=6e348cb6de24a8eb1a0e6be8fa33868d72bbe73b;hpb=cee37fe97739d85991964371c1f3a745c00dd236;p=linux-2.6.git diff --git a/arch/um/include/um_uaccess.h b/arch/um/include/um_uaccess.h index 6e348cb6d..4567f1eeb 100644 --- a/arch/um/include/um_uaccess.h +++ b/arch/um/include/um_uaccess.h @@ -17,15 +17,27 @@ #include "uaccess-skas.h" #endif -#define access_ok(type, addr, size) \ - CHOOSE_MODE_PROC(access_ok_tt, access_ok_skas, type, addr, size) +#include "asm/fixmap.h" -/* this function will go away soon - use access_ok() instead */ -static inline int __deprecated verify_area(int type, const void __user *addr, unsigned long size) -{ - return (CHOOSE_MODE_PROC(verify_area_tt, verify_area_skas, type, addr, - size)); -} +#define __under_task_size(addr, size) \ + (((unsigned long) (addr) < TASK_SIZE) && \ + (((unsigned long) (addr) + (size)) < TASK_SIZE)) + +#define __access_ok_vsyscall(type, addr, size) \ + ((type == VERIFY_READ) && \ + ((unsigned long) (addr) >= FIXADDR_USER_START) && \ + ((unsigned long) (addr) + (size) <= FIXADDR_USER_END) && \ + ((unsigned long) (addr) + (size) >= (unsigned long)(addr))) + +#define __addr_range_nowrap(addr, size) \ + ((unsigned long) (addr) <= ((unsigned long) (addr) + (size))) + +#define access_ok(type, addr, size) \ + (__addr_range_nowrap(addr, size) && \ + (__under_task_size(addr, size) || \ + __access_ok_vsyscall(type, addr, size) || \ + segment_eq(get_fs(), KERNEL_DS) || \ + CHOOSE_MODE_PROC(access_ok_tt, access_ok_skas, type, addr, size))) static inline int copy_from_user(void *to, const void __user *from, int n) {