Commit 8200dccd authored by Jesper Juhl's avatar Jesper Juhl Committed by Linus Torvalds

[PATCH] verify_area cleanup : deprecate

The previous 9 patches should take care of converting all callers of
verify_area into access_ok, so now it's time to deprecate verify_area all over
so noone gets tempted to use it in new code - this patch does that.

Eventually when this has been deprecated for a while I'll send patches to
completely remove the function (thoughts on how long it should be deprecated
first are welcome).
Signed-off-by: default avatarJesper Juhl <juhl-lkml@dif.dk>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent df7c9d51
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
#define access_ok(type, addr, size) \ #define access_ok(type, addr, size) \
CHOOSE_MODE_PROC(access_ok_tt, access_ok_skas, type, addr, size) CHOOSE_MODE_PROC(access_ok_tt, access_ok_skas, type, addr, size)
static inline int verify_area(int type, const void __user *addr, unsigned long size) /* 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, return (CHOOSE_MODE_PROC(verify_area_tt, verify_area_skas, type, addr,
size)); size));
......
...@@ -48,7 +48,8 @@ ...@@ -48,7 +48,8 @@
__access_ok(((unsigned long)(addr)),(size),get_fs()); \ __access_ok(((unsigned long)(addr)),(size),get_fs()); \
}) })
extern inline int verify_area(int type, const void __user * addr, unsigned long size) /* this function will go away soon - use access_ok() instead */
extern inline int __deprecated verify_area(int type, const void __user * addr, unsigned long size)
{ {
return access_ok(type,addr,size) ? 0 : -EFAULT; return access_ok(type,addr,size) ? 0 : -EFAULT;
} }
......
...@@ -77,7 +77,8 @@ static inline void set_fs (mm_segment_t fs) ...@@ -77,7 +77,8 @@ static inline void set_fs (mm_segment_t fs)
#define access_ok(type,addr,size) (__range_ok(addr,size) == 0) #define access_ok(type,addr,size) (__range_ok(addr,size) == 0)
static inline int verify_area(int type, const void __user *addr, unsigned long size) /* 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 access_ok(type, addr, size) ? 0 : -EFAULT; return access_ok(type, addr, size) ? 0 : -EFAULT;
} }
......
...@@ -40,7 +40,8 @@ extern int fixup_exception(struct pt_regs *regs); ...@@ -40,7 +40,8 @@ extern int fixup_exception(struct pt_regs *regs);
#define access_ok(type,addr,size) (__range_ok(addr,size) == 0) #define access_ok(type,addr,size) (__range_ok(addr,size) == 0)
static inline int verify_area(int type, const void * addr, unsigned long size) /* this function will go away soon - use access_ok() instead */
static inline int __deprecated verify_area(int type, const void * addr, unsigned long size)
{ {
return access_ok(type, addr, size) ? 0 : -EFAULT; return access_ok(type, addr, size) ? 0 : -EFAULT;
} }
......
...@@ -91,7 +91,8 @@ ...@@ -91,7 +91,8 @@
#define __access_ok(addr,size) (__kernel_ok || __user_ok((addr),(size))) #define __access_ok(addr,size) (__kernel_ok || __user_ok((addr),(size)))
#define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size)) #define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size))
extern inline int verify_area(int type, const void __user * addr, unsigned long size) /* this function will go away soon - use access_ok() instead */
extern inline int __deprecated verify_area(int type, const void __user * addr, unsigned long size)
{ {
return access_ok(type,addr,size) ? 0 : -EFAULT; return access_ok(type,addr,size) ? 0 : -EFAULT;
} }
......
...@@ -67,7 +67,8 @@ static inline int ___range_ok(unsigned long addr, unsigned long size) ...@@ -67,7 +67,8 @@ static inline int ___range_ok(unsigned long addr, unsigned long size)
#define access_ok(type,addr,size) (__range_ok((addr), (size)) == 0) #define access_ok(type,addr,size) (__range_ok((addr), (size)) == 0)
#define __access_ok(addr,size) (__range_ok((addr), (size)) == 0) #define __access_ok(addr,size) (__range_ok((addr), (size)) == 0)
static inline int verify_area(int type, const void * addr, unsigned long size) /* this function will go away soon - use access_ok() / __range_ok() instead */
static inline int __deprecated verify_area(int type, const void * addr, unsigned long size)
{ {
return __range_ok(addr, size); return __range_ok(addr, size);
} }
......
...@@ -24,7 +24,8 @@ static inline int __access_ok(unsigned long addr, unsigned long size) ...@@ -24,7 +24,8 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
return(RANGE_CHECK_OK(addr, size, 0L, (unsigned long)&_ramend)); return(RANGE_CHECK_OK(addr, size, 0L, (unsigned long)&_ramend));
} }
static inline int verify_area(int type, const void *addr, unsigned long size) /* this function will go away soon - use access_ok() instead */
static inline int __deprecated verify_area(int type, const void *addr, unsigned long size)
{ {
return access_ok(type,addr,size)?0:-EFAULT; return access_ok(type,addr,size)?0:-EFAULT;
} }
......
...@@ -84,7 +84,8 @@ extern struct movsl_mask { ...@@ -84,7 +84,8 @@ extern struct movsl_mask {
#define access_ok(type,addr,size) (likely(__range_ok(addr,size) == 0)) #define access_ok(type,addr,size) (likely(__range_ok(addr,size) == 0))
/** /**
* verify_area: - Obsolete, use access_ok() * verify_area: - Obsolete/deprecated and will go away soon,
* use access_ok() instead.
* @type: Type of access: %VERIFY_READ or %VERIFY_WRITE * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE
* @addr: User space pointer to start of block to check * @addr: User space pointer to start of block to check
* @size: Size of block to check * @size: Size of block to check
...@@ -100,7 +101,7 @@ extern struct movsl_mask { ...@@ -100,7 +101,7 @@ extern struct movsl_mask {
* *
* See access_ok() for more details. * See access_ok() for more details.
*/ */
static inline int verify_area(int type, const void __user * addr, unsigned long size) static inline int __deprecated verify_area(int type, const void __user * addr, unsigned long size)
{ {
return access_ok(type,addr,size) ? 0 : -EFAULT; return access_ok(type,addr,size) ? 0 : -EFAULT;
} }
......
...@@ -71,7 +71,8 @@ ...@@ -71,7 +71,8 @@
}) })
#define access_ok(type, addr, size) __access_ok((addr), (size), get_fs()) #define access_ok(type, addr, size) __access_ok((addr), (size), get_fs())
static inline int /* 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) verify_area (int type, const void __user *addr, unsigned long size)
{ {
return access_ok(type, addr, size) ? 0 : -EFAULT; return access_ok(type, addr, size) ? 0 : -EFAULT;
......
...@@ -121,7 +121,8 @@ static inline int access_ok(int type, const void *addr, unsigned long size) ...@@ -121,7 +121,8 @@ static inline int access_ok(int type, const void *addr, unsigned long size)
#endif /* CONFIG_MMU */ #endif /* CONFIG_MMU */
/** /**
* verify_area: - Obsolete, use access_ok() * verify_area: - Obsolete/deprecated and will go away soon,
* use access_ok() instead.
* @type: Type of access: %VERIFY_READ or %VERIFY_WRITE * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE
* @addr: User space pointer to start of block to check * @addr: User space pointer to start of block to check
* @size: Size of block to check * @size: Size of block to check
...@@ -137,7 +138,7 @@ static inline int access_ok(int type, const void *addr, unsigned long size) ...@@ -137,7 +138,7 @@ static inline int access_ok(int type, const void *addr, unsigned long size)
* *
* See access_ok() for more details. * See access_ok() for more details.
*/ */
static inline int verify_area(int type, const void __user *addr, static inline int __deprecated verify_area(int type, const void __user *addr,
unsigned long size) unsigned long size)
{ {
return access_ok(type, addr, size) ? 0 : -EFAULT; return access_ok(type, addr, size) ? 0 : -EFAULT;
......
...@@ -14,9 +14,10 @@ ...@@ -14,9 +14,10 @@
/* We let the MMU do all checking */ /* We let the MMU do all checking */
#define access_ok(type,addr,size) 1 #define access_ok(type,addr,size) 1
static inline int verify_area(int type, const void *addr, unsigned long size) /* this function will go away soon - use access_ok() instead */
static inline int __deprecated verify_area(int type, const void *addr, unsigned long size)
{ {
return access_ok(type,addr,size)?0:-EFAULT; return access_ok(type,addr,size) ? 0 : -EFAULT;
} }
/* /*
......
...@@ -23,7 +23,8 @@ static inline int _access_ok(unsigned long addr, unsigned long size) ...@@ -23,7 +23,8 @@ static inline int _access_ok(unsigned long addr, unsigned long size)
(is_in_rom(addr) && is_in_rom(addr+size))); (is_in_rom(addr) && is_in_rom(addr+size)));
} }
extern inline int verify_area(int type, const void * addr, unsigned long size) /* this function will go away soon - use access_ok() instead */
extern inline int __deprecated verify_area(int type, const void * addr, unsigned long size)
{ {
return access_ok(type,addr,size)?0:-EFAULT; return access_ok(type,addr,size)?0:-EFAULT;
} }
......
...@@ -112,7 +112,8 @@ ...@@ -112,7 +112,8 @@
likely(__access_ok((unsigned long)(addr), (size),__access_mask)) likely(__access_ok((unsigned long)(addr), (size),__access_mask))
/* /*
* verify_area: - Obsolete, use access_ok() * verify_area: - Obsolete/deprecated and will go away soon,
* use access_ok() instead.
* @type: Type of access: %VERIFY_READ or %VERIFY_WRITE * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE
* @addr: User space pointer to start of block to check * @addr: User space pointer to start of block to check
* @size: Size of block to check * @size: Size of block to check
...@@ -128,7 +129,7 @@ ...@@ -128,7 +129,7 @@
* *
* See access_ok() for more details. * See access_ok() for more details.
*/ */
static inline int verify_area(int type, const void * addr, unsigned long size) static inline int __deprecated verify_area(int type, const void * addr, unsigned long size)
{ {
return access_ok(type, addr, size) ? 0 : -EFAULT; return access_ok(type, addr, size) ? 0 : -EFAULT;
} }
......
...@@ -40,7 +40,9 @@ static inline long access_ok(int type, const void __user * addr, ...@@ -40,7 +40,9 @@ static inline long access_ok(int type, const void __user * addr,
return 1; return 1;
} }
#define verify_area(type,addr,size) (0) #define verify_area(type,addr,size) (0) /* FIXME: all users should go away soon,
* and use access_ok instead, then this
* should be removed. */
#define put_user __put_user #define put_user __put_user
#define get_user __get_user #define get_user __get_user
......
...@@ -37,7 +37,8 @@ ...@@ -37,7 +37,8 @@
#define access_ok(type, addr, size) \ #define access_ok(type, addr, size) \
(__chk_user_ptr(addr),__access_ok((unsigned long)(addr),(size))) (__chk_user_ptr(addr),__access_ok((unsigned long)(addr),(size)))
extern inline int verify_area(int type, const void __user * addr, unsigned long size) /* this function will go away soon - use access_ok() instead */
extern inline int __deprecated verify_area(int type, const void __user * addr, unsigned long size)
{ {
return access_ok(type, addr, size) ? 0 : -EFAULT; return access_ok(type, addr, size) ? 0 : -EFAULT;
} }
......
...@@ -56,7 +56,8 @@ ...@@ -56,7 +56,8 @@
#define access_ok(type,addr,size) \ #define access_ok(type,addr,size) \
__access_ok(((__force unsigned long)(addr)),(size),get_fs()) __access_ok(((__force unsigned long)(addr)),(size),get_fs())
static inline int verify_area(int type, const void __user *addr, unsigned long size) /* 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 access_ok(type,addr,size) ? 0 : -EFAULT; return access_ok(type,addr,size) ? 0 : -EFAULT;
} }
......
...@@ -65,7 +65,8 @@ ...@@ -65,7 +65,8 @@
#define access_ok(type,addr,size) __access_ok(addr,size) #define access_ok(type,addr,size) __access_ok(addr,size)
extern inline int verify_area(int type, const void __user *addr, /* this function will go away soon - use access_ok() instead */
extern inline int __deprecated verify_area(int type, const void __user *addr,
unsigned long size) unsigned long size)
{ {
return access_ok(type, addr, size) ? 0 : -EFAULT; return access_ok(type, addr, size) ? 0 : -EFAULT;
......
...@@ -146,7 +146,8 @@ static inline int access_ok(int type, const void __user *p, unsigned long size) ...@@ -146,7 +146,8 @@ static inline int access_ok(int type, const void __user *p, unsigned long size)
return __access_ok(addr, size); return __access_ok(addr, size);
} }
static inline int verify_area(int type, const void __user * addr, unsigned long size) /* 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 access_ok(type,addr,size) ? 0 : -EFAULT; return access_ok(type,addr,size) ? 0 : -EFAULT;
} }
......
...@@ -60,7 +60,8 @@ ...@@ -60,7 +60,8 @@
#define access_ok(type,addr,size) (__range_ok(addr,size) == 0) #define access_ok(type,addr,size) (__range_ok(addr,size) == 0)
#define __access_ok(addr,size) (__range_ok(addr,size) == 0) #define __access_ok(addr,size) (__range_ok(addr,size) == 0)
extern inline int verify_area(int type, const void __user * addr, unsigned long size) /* this function will go away soon - use access_ok() instead */
extern inline int __deprecated verify_area(int type, const void __user * addr, unsigned long size)
{ {
return access_ok(type,addr,size) ? 0 : -EFAULT; return access_ok(type,addr,size) ? 0 : -EFAULT;
} }
......
...@@ -46,9 +46,10 @@ ...@@ -46,9 +46,10 @@
#define __access_ok(addr,size) (__user_ok((addr) & get_fs().seg,(size))) #define __access_ok(addr,size) (__user_ok((addr) & get_fs().seg,(size)))
#define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size)) #define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size))
static inline int verify_area(int type, const void __user * addr, unsigned long size) /* 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 access_ok(type,addr,size)?0:-EFAULT; return access_ok(type,addr,size) ? 0 : -EFAULT;
} }
/* /*
......
...@@ -59,7 +59,8 @@ static inline int access_ok(int type, const void __user * addr, unsigned long si ...@@ -59,7 +59,8 @@ static inline int access_ok(int type, const void __user * addr, unsigned long si
return 1; return 1;
} }
static inline int verify_area(int type, const void __user * addr, unsigned long size) /* 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 0; return 0;
} }
......
...@@ -27,7 +27,8 @@ extern inline int access_ok (int type, const void *addr, unsigned long size) ...@@ -27,7 +27,8 @@ extern inline int access_ok (int type, const void *addr, unsigned long size)
return val >= (0x80 + NUM_CPU_IRQS*16) && val < 0xFFFFF000; return val >= (0x80 + NUM_CPU_IRQS*16) && val < 0xFFFFF000;
} }
extern inline int verify_area (int type, const void *addr, unsigned long size) /* this function will go away soon - use access_ok() instead */
extern inline int __deprecated verify_area (int type, const void *addr, unsigned long size)
{ {
return access_ok (type, addr, size) ? 0 : -EFAULT; return access_ok (type, addr, size) ? 0 : -EFAULT;
} }
......
...@@ -49,7 +49,8 @@ ...@@ -49,7 +49,8 @@
#define access_ok(type, addr, size) (__range_not_ok(addr,size) == 0) #define access_ok(type, addr, size) (__range_not_ok(addr,size) == 0)
extern inline int verify_area(int type, const void __user * addr, unsigned long size) /* this function will go away soon - use access_ok() instead */
extern inline int __deprecated verify_area(int type, const void __user * addr, unsigned long size)
{ {
return access_ok(type,addr,size) ? 0 : -EFAULT; return access_ok(type,addr,size) ? 0 : -EFAULT;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment