diff options
author | Namhyung Kim <namhyung@gmail.com> | 2010-10-27 18:33:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-27 21:03:10 -0400 |
commit | eb5a3699311ba8ed22b7b38ceb3bb1411e438e2a (patch) | |
tree | 1dbe526da49f057cb30378991fb85b1dbaf0edc4 /arch/x86/kernel | |
parent | 9b05a69e0534ec70bc94921936ffa05b330507cb (diff) |
ptrace: cleanup arch_ptrace() on x86
Remove checking @addr less than 0 because @addr is now unsigned and
use new udescp variable in order to remove unnecessary castings.
[akpm@linux-foundation.org: fix unused variable 'udescp']
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/ptrace.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index 1a7ca045920d..45892dc4b72a 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c | |||
@@ -813,8 +813,7 @@ long arch_ptrace(struct task_struct *child, long request, | |||
813 | unsigned long tmp; | 813 | unsigned long tmp; |
814 | 814 | ||
815 | ret = -EIO; | 815 | ret = -EIO; |
816 | if ((addr & (sizeof(data) - 1)) || addr < 0 || | 816 | if ((addr & (sizeof(data) - 1)) || addr >= sizeof(struct user)) |
817 | addr >= sizeof(struct user)) | ||
818 | break; | 817 | break; |
819 | 818 | ||
820 | tmp = 0; /* Default return condition */ | 819 | tmp = 0; /* Default return condition */ |
@@ -831,8 +830,7 @@ long arch_ptrace(struct task_struct *child, long request, | |||
831 | 830 | ||
832 | case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ | 831 | case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ |
833 | ret = -EIO; | 832 | ret = -EIO; |
834 | if ((addr & (sizeof(data) - 1)) || addr < 0 || | 833 | if ((addr & (sizeof(data) - 1)) || addr >= sizeof(struct user)) |
835 | addr >= sizeof(struct user)) | ||
836 | break; | 834 | break; |
837 | 835 | ||
838 | if (addr < sizeof(struct user_regs_struct)) | 836 | if (addr < sizeof(struct user_regs_struct)) |
@@ -892,14 +890,14 @@ long arch_ptrace(struct task_struct *child, long request, | |||
892 | if ((int) addr < 0) | 890 | if ((int) addr < 0) |
893 | return -EIO; | 891 | return -EIO; |
894 | ret = do_get_thread_area(child, addr, | 892 | ret = do_get_thread_area(child, addr, |
895 | (struct user_desc __user *) data); | 893 | (struct user_desc __user *)data); |
896 | break; | 894 | break; |
897 | 895 | ||
898 | case PTRACE_SET_THREAD_AREA: | 896 | case PTRACE_SET_THREAD_AREA: |
899 | if ((int) addr < 0) | 897 | if ((int) addr < 0) |
900 | return -EIO; | 898 | return -EIO; |
901 | ret = do_set_thread_area(child, addr, | 899 | ret = do_set_thread_area(child, addr, |
902 | (struct user_desc __user *) data, 0); | 900 | (struct user_desc __user *)data, 0); |
903 | break; | 901 | break; |
904 | #endif | 902 | #endif |
905 | 903 | ||