diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-03-31 05:30:15 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-31 15:18:51 -0500 |
commit | 4d338e1accfc3473f7e453427dfd4f1ebf4dbbe6 (patch) | |
tree | ac6559e533cd4720b5c5b13119b3d10f0ab8b51d /arch/um/kernel/ptrace.c | |
parent | 694a464e19b9e3278dbaf6a09fa7c1efec3f8eb5 (diff) |
[PATCH] uml: sparse cleanups
misc sparse annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/kernel/ptrace.c')
-rw-r--r-- | arch/um/kernel/ptrace.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c index 98e09395c093..394582202ce6 100644 --- a/arch/um/kernel/ptrace.c +++ b/arch/um/kernel/ptrace.c | |||
@@ -46,6 +46,7 @@ extern int poke_user(struct task_struct * child, long addr, long data); | |||
46 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) | 46 | long arch_ptrace(struct task_struct *child, long request, long addr, long data) |
47 | { | 47 | { |
48 | int i, ret; | 48 | int i, ret; |
49 | unsigned long __user *p = (void __user *)(unsigned long)data; | ||
49 | 50 | ||
50 | switch (request) { | 51 | switch (request) { |
51 | /* when I and D space are separate, these will need to be fixed. */ | 52 | /* when I and D space are separate, these will need to be fixed. */ |
@@ -58,7 +59,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
58 | copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0); | 59 | copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0); |
59 | if (copied != sizeof(tmp)) | 60 | if (copied != sizeof(tmp)) |
60 | break; | 61 | break; |
61 | ret = put_user(tmp, (unsigned long __user *) data); | 62 | ret = put_user(tmp, p); |
62 | break; | 63 | break; |
63 | } | 64 | } |
64 | 65 | ||
@@ -136,15 +137,13 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
136 | 137 | ||
137 | #ifdef PTRACE_GETREGS | 138 | #ifdef PTRACE_GETREGS |
138 | case PTRACE_GETREGS: { /* Get all gp regs from the child. */ | 139 | case PTRACE_GETREGS: { /* Get all gp regs from the child. */ |
139 | if (!access_ok(VERIFY_WRITE, (unsigned long *)data, | 140 | if (!access_ok(VERIFY_WRITE, p, MAX_REG_OFFSET)) { |
140 | MAX_REG_OFFSET)) { | ||
141 | ret = -EIO; | 141 | ret = -EIO; |
142 | break; | 142 | break; |
143 | } | 143 | } |
144 | for ( i = 0; i < MAX_REG_OFFSET; i += sizeof(long) ) { | 144 | for ( i = 0; i < MAX_REG_OFFSET; i += sizeof(long) ) { |
145 | __put_user(getreg(child, i), | 145 | __put_user(getreg(child, i), p); |
146 | (unsigned long __user *) data); | 146 | p++; |
147 | data += sizeof(long); | ||
148 | } | 147 | } |
149 | ret = 0; | 148 | ret = 0; |
150 | break; | 149 | break; |
@@ -153,15 +152,14 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
153 | #ifdef PTRACE_SETREGS | 152 | #ifdef PTRACE_SETREGS |
154 | case PTRACE_SETREGS: { /* Set all gp regs in the child. */ | 153 | case PTRACE_SETREGS: { /* Set all gp regs in the child. */ |
155 | unsigned long tmp = 0; | 154 | unsigned long tmp = 0; |
156 | if (!access_ok(VERIFY_READ, (unsigned *)data, | 155 | if (!access_ok(VERIFY_READ, p, MAX_REG_OFFSET)) { |
157 | MAX_REG_OFFSET)) { | ||
158 | ret = -EIO; | 156 | ret = -EIO; |
159 | break; | 157 | break; |
160 | } | 158 | } |
161 | for ( i = 0; i < MAX_REG_OFFSET; i += sizeof(long) ) { | 159 | for ( i = 0; i < MAX_REG_OFFSET; i += sizeof(long) ) { |
162 | __get_user(tmp, (unsigned long __user *) data); | 160 | __get_user(tmp, p); |
163 | putreg(child, i, tmp); | 161 | putreg(child, i, tmp); |
164 | data += sizeof(long); | 162 | p++; |
165 | } | 163 | } |
166 | ret = 0; | 164 | ret = 0; |
167 | break; | 165 | break; |
@@ -188,13 +186,12 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
188 | break; | 186 | break; |
189 | #endif | 187 | #endif |
190 | case PTRACE_FAULTINFO: { | 188 | case PTRACE_FAULTINFO: { |
191 | /* Take the info from thread->arch->faultinfo, | 189 | /* Take the info from thread->arch->faultinfo, |
192 | * but transfer max. sizeof(struct ptrace_faultinfo). | 190 | * but transfer max. sizeof(struct ptrace_faultinfo). |
193 | * On i386, ptrace_faultinfo is smaller! | 191 | * On i386, ptrace_faultinfo is smaller! |
194 | */ | 192 | */ |
195 | ret = copy_to_user((unsigned long __user *) data, | 193 | ret = copy_to_user(p, &child->thread.arch.faultinfo, |
196 | &child->thread.arch.faultinfo, | 194 | sizeof(struct ptrace_faultinfo)); |
197 | sizeof(struct ptrace_faultinfo)); | ||
198 | if(ret) | 195 | if(ret) |
199 | break; | 196 | break; |
200 | break; | 197 | break; |
@@ -204,8 +201,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
204 | case PTRACE_LDT: { | 201 | case PTRACE_LDT: { |
205 | struct ptrace_ldt ldt; | 202 | struct ptrace_ldt ldt; |
206 | 203 | ||
207 | if(copy_from_user(&ldt, (unsigned long __user *) data, | 204 | if(copy_from_user(&ldt, p, sizeof(ldt))){ |
208 | sizeof(ldt))){ | ||
209 | ret = -EIO; | 205 | ret = -EIO; |
210 | break; | 206 | break; |
211 | } | 207 | } |