Skip to content

Commit b9e122c

Browse files
Jesper JuhlLinus Torvalds
authored andcommitted
[PATCH] xtensa: remove verify_area macros
verify_area() is still alive on xtensa in 2.6.17-rc3-git13 It would be nice to finally be rid of that function across the board. Signed-off-by: Chris Zankel <chris@zankel.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 6f36d17 commit b9e122c

6 files changed

Lines changed: 13 additions & 47 deletions

File tree

‎arch/xtensa/Kconfig‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ config GENERIC_HARDIRQS
3434
bool
3535
default y
3636

37-
config RWSEM_GENERIC_SPINLOCK
38-
bool
39-
default y
40-
4137
source "init/Kconfig"
4238

4339
menu "Processor type and features"

‎arch/xtensa/kernel/entry.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,7 @@ ENTRY(fast_syscall_sysxtensa)
11021102
s32i a7, a2, PT_AREG7
11031103

11041104
movi a7, 4 # sizeof(unsigned int)
1105-
verify_area a3, a7, a0, a2, .Leac
1105+
access_ok a0, a3, a7, a2, .Leac
11061106

11071107
_beqi a6, SYSXTENSA_ATOMIC_SET, .Lset
11081108
_beqi a6, SYSXTENSA_ATOMIC_EXG_ADD, .Lexg

‎arch/xtensa/kernel/signal.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ sys_sigaction(int sig, const struct old_sigaction *act,
104104

105105
if (act) {
106106
old_sigset_t mask;
107-
if (verify_area(VERIFY_READ, act, sizeof(*act)) ||
107+
if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
108108
__get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
109109
__get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
110110
return -EFAULT;
@@ -116,7 +116,7 @@ sys_sigaction(int sig, const struct old_sigaction *act,
116116
ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
117117

118118
if (!ret && oact) {
119-
if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) ||
119+
if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
120120
__put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
121121
__put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
122122
return -EFAULT;
@@ -236,7 +236,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc)
236236
err |= __copy_from_user (regs->areg, sc->sc_areg, XCHAL_NUM_AREGS*4);
237237
err |= __get_user(buf, &sc->sc_cpstate);
238238
if (buf) {
239-
if (verify_area(VERIFY_READ, buf, sizeof(*buf)))
239+
if (!access_ok(VERIFY_READ, buf, sizeof(*buf)))
240240
goto badframe;
241241
err |= restore_cpextra(buf);
242242
}
@@ -357,7 +357,7 @@ asmlinkage int sys_sigreturn(struct pt_regs *regs)
357357
if (regs->depc > 64)
358358
panic ("Double exception sys_sigreturn\n");
359359

360-
if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
360+
if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
361361
goto badframe;
362362

363363
if (__get_user(set.sig[0], &frame->sc.oldmask)
@@ -394,7 +394,7 @@ asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
394394
return 0;
395395
}
396396

397-
if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
397+
if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
398398
goto badframe;
399399

400400
if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))

‎include/asm-xtensa/checksum.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ asmlinkage unsigned int csum_partial_copy_generic( const char *src, char *dst, i
4343
* Note: when you get a NULL pointer exception here this means someone
4444
* passed in an incorrect kernel address to one of these functions.
4545
*
46-
* If you use these functions directly please don't forget the
47-
* verify_area().
46+
* If you use these functions directly please don't forget the access_ok().
4847
*/
4948
static inline
5049
unsigned int csum_partial_copy_nocheck ( const char *src, char *dst,

‎include/asm-xtensa/rwsem.h‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,9 @@ static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem)
172172
return atomic_add_return(delta, (atomic_t *)(&sem->count));
173173
}
174174

175-
#endif /* _XTENSA_RWSEM_XADD_H */
175+
static inline int rwsem_is_locked(struct rw_semaphore *sem)
176+
{
177+
return (sem->count != 0);
178+
}
179+
180+
#endif /* _XTENSA_RWSEM_H */

‎include/asm-xtensa/uaccess.h‎

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -154,35 +154,6 @@
154154
.Laccess_ok_\@:
155155
.endm
156156

157-
/*
158-
* verify_area determines whether a memory access is allowed. It's
159-
* mostly an unnecessary wrapper for access_ok, but we provide it as a
160-
* duplicate of the verify_area() C inline function below. See the
161-
* equivalent C version below for clarity.
162-
*
163-
* On error, verify_area branches to a label indicated by parameter
164-
* <error>. This implies that the macro falls through to the next
165-
* instruction on success.
166-
*
167-
* Note that we assume success is the common case, and we optimize the
168-
* branch fall-through case on success.
169-
*
170-
* On Entry:
171-
* <aa> register containing memory address
172-
* <as> register containing memory size
173-
* <at> temp register
174-
* <error> label to branch to on error; implies fall-through
175-
* macro on success
176-
* On Exit:
177-
* <aa> preserved
178-
* <as> preserved
179-
* <at> destroyed
180-
*/
181-
.macro verify_area aa, as, at, sp, error
182-
access_ok \at, \aa, \as, \sp, \error
183-
.endm
184-
185-
186157
#else /* __ASSEMBLY__ not defined */
187158

188159
#include <linux/sched.h>
@@ -211,11 +182,6 @@
211182
#define __access_ok(addr,size) (__kernel_ok || __user_ok((addr),(size)))
212183
#define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size))
213184

214-
static inline int verify_area(int type, const void * addr, unsigned long size)
215-
{
216-
return access_ok(type,addr,size) ? 0 : -EFAULT;
217-
}
218-
219185
/*
220186
* These are the main single-value transfer routines. They
221187
* automatically use the right size if we just have the right pointer

0 commit comments

Comments
 (0)