diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2008-10-27 07:24:09 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-11-27 07:37:59 -0500 |
commit | 59f0cb0fddc14ffc6676ae62e911f8115ebc8ccf (patch) | |
tree | 1e5fc347287c02e83dce967180c96906f6ed7455 /arch/arm/include | |
parent | ed313489badef16d700f5a3be50e8fd8f8294bc8 (diff) |
[ARM] remove memzero()
As suggested by Andrew Morton, remove memzero() - it's not supported
on other architectures so use of it is a potential build breaking bug.
Since the compiler optimizes memset(x,0,n) to __memzero() perfectly
well, we don't miss out on the underlying benefits of memzero().
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/include')
-rw-r--r-- | arch/arm/include/asm/page.h | 2 | ||||
-rw-r--r-- | arch/arm/include/asm/processor.h | 2 | ||||
-rw-r--r-- | arch/arm/include/asm/string.h | 9 | ||||
-rw-r--r-- | arch/arm/include/asm/uaccess.h | 2 |
4 files changed, 3 insertions, 12 deletions
diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h index bed1c0a00368..5fee45e23038 100644 --- a/arch/arm/include/asm/page.h +++ b/arch/arm/include/asm/page.h | |||
@@ -133,7 +133,7 @@ extern void __cpu_copy_user_page(void *to, const void *from, | |||
133 | #define clear_user_page(addr,vaddr,pg) __cpu_clear_user_page(addr, vaddr) | 133 | #define clear_user_page(addr,vaddr,pg) __cpu_clear_user_page(addr, vaddr) |
134 | #define copy_user_page(to,from,vaddr,pg) __cpu_copy_user_page(to, from, vaddr) | 134 | #define copy_user_page(to,from,vaddr,pg) __cpu_copy_user_page(to, from, vaddr) |
135 | 135 | ||
136 | #define clear_page(page) memzero((void *)(page), PAGE_SIZE) | 136 | #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) |
137 | extern void copy_page(void *to, const void *from); | 137 | extern void copy_page(void *to, const void *from); |
138 | 138 | ||
139 | #undef STRICT_MM_TYPECHECKS | 139 | #undef STRICT_MM_TYPECHECKS |
diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h index 517a4d6ffc74..2320508443a5 100644 --- a/arch/arm/include/asm/processor.h +++ b/arch/arm/include/asm/processor.h | |||
@@ -64,7 +64,7 @@ struct thread_struct { | |||
64 | ({ \ | 64 | ({ \ |
65 | unsigned long *stack = (unsigned long *)sp; \ | 65 | unsigned long *stack = (unsigned long *)sp; \ |
66 | set_fs(USER_DS); \ | 66 | set_fs(USER_DS); \ |
67 | memzero(regs->uregs, sizeof(regs->uregs)); \ | 67 | memset(regs->uregs, 0, sizeof(regs->uregs)); \ |
68 | if (current->personality & ADDR_LIMIT_32BIT) \ | 68 | if (current->personality & ADDR_LIMIT_32BIT) \ |
69 | regs->ARM_cpsr = USR_MODE; \ | 69 | regs->ARM_cpsr = USR_MODE; \ |
70 | else \ | 70 | else \ |
diff --git a/arch/arm/include/asm/string.h b/arch/arm/include/asm/string.h index e50c4a39b699..cf4f3aad0fc1 100644 --- a/arch/arm/include/asm/string.h +++ b/arch/arm/include/asm/string.h | |||
@@ -21,7 +21,6 @@ extern void * memmove(void *, const void *, __kernel_size_t); | |||
21 | #define __HAVE_ARCH_MEMCHR | 21 | #define __HAVE_ARCH_MEMCHR |
22 | extern void * memchr(const void *, int, __kernel_size_t); | 22 | extern void * memchr(const void *, int, __kernel_size_t); |
23 | 23 | ||
24 | #define __HAVE_ARCH_MEMZERO | ||
25 | #define __HAVE_ARCH_MEMSET | 24 | #define __HAVE_ARCH_MEMSET |
26 | extern void * memset(void *, int, __kernel_size_t); | 25 | extern void * memset(void *, int, __kernel_size_t); |
27 | 26 | ||
@@ -39,12 +38,4 @@ extern void __memzero(void *ptr, __kernel_size_t n); | |||
39 | (__p); \ | 38 | (__p); \ |
40 | }) | 39 | }) |
41 | 40 | ||
42 | #define memzero(p,n) \ | ||
43 | ({ \ | ||
44 | void *__p = (p); size_t __n = n; \ | ||
45 | if ((__n) != 0) \ | ||
46 | __memzero((__p),(__n)); \ | ||
47 | (__p); \ | ||
48 | }) | ||
49 | |||
50 | #endif | 41 | #endif |
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h index e98ec60b3400..cbb7a37e2978 100644 --- a/arch/arm/include/asm/uaccess.h +++ b/arch/arm/include/asm/uaccess.h | |||
@@ -400,7 +400,7 @@ static inline unsigned long __must_check copy_from_user(void *to, const void __u | |||
400 | if (access_ok(VERIFY_READ, from, n)) | 400 | if (access_ok(VERIFY_READ, from, n)) |
401 | n = __copy_from_user(to, from, n); | 401 | n = __copy_from_user(to, from, n); |
402 | else /* security hole - plug it */ | 402 | else /* security hole - plug it */ |
403 | memzero(to, n); | 403 | memset(to, 0, n); |
404 | return n; | 404 | return n; |
405 | } | 405 | } |
406 | 406 | ||