diff options
author | Namhyung Kim <namhyung@gmail.com> | 2010-10-27 18:34:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-27 21:03:12 -0400 |
commit | 0a3d763f1a68c97daae57e40c6d698986d1b38f4 (patch) | |
tree | b88189bb89beadc12e414c27be08c26ad837dbbd | |
parent | 8c0acac3676103113a2e259291a07c073ac07879 (diff) |
ptrace: cleanup arch_ptrace() on um
Remove unnecessary castings using void pointer and fix copy_to_user()
return value. Also add missing __user markup on the argument of
arch_ptrctl().
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/um/kernel/ptrace.c | 18 | ||||
-rw-r--r-- | arch/um/sys-x86_64/ptrace.c | 7 |
2 files changed, 11 insertions, 14 deletions
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c index 963d82bdec06..a5e33f29bbeb 100644 --- a/arch/um/kernel/ptrace.c +++ b/arch/um/kernel/ptrace.c | |||
@@ -47,6 +47,7 @@ long arch_ptrace(struct task_struct *child, long request, | |||
47 | { | 47 | { |
48 | int i, ret; | 48 | int i, ret; |
49 | unsigned long __user *p = (void __user *)data; | 49 | unsigned long __user *p = (void __user *)data; |
50 | void __user *vp = p; | ||
50 | 51 | ||
51 | switch (request) { | 52 | switch (request) { |
52 | /* read word at location addr. */ | 53 | /* read word at location addr. */ |
@@ -108,24 +109,20 @@ long arch_ptrace(struct task_struct *child, long request, | |||
108 | #endif | 109 | #endif |
109 | #ifdef PTRACE_GETFPREGS | 110 | #ifdef PTRACE_GETFPREGS |
110 | case PTRACE_GETFPREGS: /* Get the child FPU state. */ | 111 | case PTRACE_GETFPREGS: /* Get the child FPU state. */ |
111 | ret = get_fpregs((struct user_i387_struct __user *) data, | 112 | ret = get_fpregs(vp, child); |
112 | child); | ||
113 | break; | 113 | break; |
114 | #endif | 114 | #endif |
115 | #ifdef PTRACE_SETFPREGS | 115 | #ifdef PTRACE_SETFPREGS |
116 | case PTRACE_SETFPREGS: /* Set the child FPU state. */ | 116 | case PTRACE_SETFPREGS: /* Set the child FPU state. */ |
117 | ret = set_fpregs((struct user_i387_struct __user *) data, | 117 | ret = set_fpregs(vp, child); |
118 | child); | ||
119 | break; | 118 | break; |
120 | #endif | 119 | #endif |
121 | case PTRACE_GET_THREAD_AREA: | 120 | case PTRACE_GET_THREAD_AREA: |
122 | ret = ptrace_get_thread_area(child, addr, | 121 | ret = ptrace_get_thread_area(child, addr, vp); |
123 | (struct user_desc __user *) data); | ||
124 | break; | 122 | break; |
125 | 123 | ||
126 | case PTRACE_SET_THREAD_AREA: | 124 | case PTRACE_SET_THREAD_AREA: |
127 | ret = ptrace_set_thread_area(child, addr, | 125 | ret = ptrace_set_thread_area(child, addr, datavp); |
128 | (struct user_desc __user *) data); | ||
129 | break; | 126 | break; |
130 | 127 | ||
131 | case PTRACE_FAULTINFO: { | 128 | case PTRACE_FAULTINFO: { |
@@ -135,7 +132,8 @@ long arch_ptrace(struct task_struct *child, long request, | |||
135 | * On i386, ptrace_faultinfo is smaller! | 132 | * On i386, ptrace_faultinfo is smaller! |
136 | */ | 133 | */ |
137 | ret = copy_to_user(p, &child->thread.arch.faultinfo, | 134 | ret = copy_to_user(p, &child->thread.arch.faultinfo, |
138 | sizeof(struct ptrace_faultinfo)); | 135 | sizeof(struct ptrace_faultinfo)) ? |
136 | -EIO : 0; | ||
139 | break; | 137 | break; |
140 | } | 138 | } |
141 | 139 | ||
@@ -159,7 +157,7 @@ long arch_ptrace(struct task_struct *child, long request, | |||
159 | #ifdef PTRACE_ARCH_PRCTL | 157 | #ifdef PTRACE_ARCH_PRCTL |
160 | case PTRACE_ARCH_PRCTL: | 158 | case PTRACE_ARCH_PRCTL: |
161 | /* XXX Calls ptrace on the host - needs some SMP thinking */ | 159 | /* XXX Calls ptrace on the host - needs some SMP thinking */ |
162 | ret = arch_prctl(child, data, (void *) addr); | 160 | ret = arch_prctl(child, data, (void __user *) addr); |
163 | break; | 161 | break; |
164 | #endif | 162 | #endif |
165 | default: | 163 | default: |
diff --git a/arch/um/sys-x86_64/ptrace.c b/arch/um/sys-x86_64/ptrace.c index 67e63680df28..f43613643cdb 100644 --- a/arch/um/sys-x86_64/ptrace.c +++ b/arch/um/sys-x86_64/ptrace.c | |||
@@ -179,15 +179,14 @@ long subarch_ptrace(struct task_struct *child, long request, | |||
179 | unsigned long addr, unsigned long data) | 179 | unsigned long addr, unsigned long data) |
180 | { | 180 | { |
181 | int ret = -EIO; | 181 | int ret = -EIO; |
182 | void __user *datap = (void __user *) data; | ||
182 | 183 | ||
183 | switch (request) { | 184 | switch (request) { |
184 | case PTRACE_GETFPXREGS: /* Get the child FPU state. */ | 185 | case PTRACE_GETFPXREGS: /* Get the child FPU state. */ |
185 | ret = get_fpregs((struct user_i387_struct __user *) data, | 186 | ret = get_fpregs(datap, child); |
186 | child); | ||
187 | break; | 187 | break; |
188 | case PTRACE_SETFPXREGS: /* Set the child FPU state. */ | 188 | case PTRACE_SETFPXREGS: /* Set the child FPU state. */ |
189 | ret = set_fpregs((struct user_i387_struct __user *) data, | 189 | ret = set_fpregs(datap, child); |
190 | child); | ||
191 | break; | 190 | break; |
192 | } | 191 | } |
193 | 192 | ||