lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1282902149-12991-6-git-send-email-namhyung@gmail.com>
Date:	Fri, 27 Aug 2010 18:41:51 +0900
From:	Namhyung Kim <namhyung@...il.com>
To:	Roland McGrath <roland@...hat.com>,
	Oleg Nesterov <oleg@...hat.com>, Arnd Bergmann <arnd@...db.de>
Cc:	linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>
Subject: [RFC PATCH 05/43] ptrace, x86: cleanup arch_ptrace()

change type of 'datap' variable into void pointer in order to remove
unnecessary castings.

Signed-off-by: Namhyung Kim <namhyung@...il.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: "H. Peter Anvin" <hpa@...or.com>
---
 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 ea7766a..29c17610 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -805,7 +805,7 @@ long arch_ptrace(struct task_struct *child, long request,
 		 unsigned long addr, unsigned long data)
 {
 	int ret;
-	unsigned long __user *datap = (unsigned long __user *)data;
+	void __user *datap = (void __user *)data;
 
 	switch (request) {
 	/* read the word at location addr in the USER area. */
@@ -824,7 +824,7 @@ long arch_ptrace(struct task_struct *child, long request,
 			addr -= offsetof(struct user, u_debugreg[0]);
 			tmp = ptrace_get_debugreg(child, addr / sizeof(data));
 		}
-		ret = put_user(tmp, datap);
+		ret = copy_to_user(datap, &tmp, sizeof(tmp)) ? -EFAULT : 0;
 		break;
 	}
 
@@ -889,15 +889,13 @@ long arch_ptrace(struct task_struct *child, long request,
 	case PTRACE_GET_THREAD_AREA:
 		if ((int) addr < 0)
 			return -EIO;
-		ret = do_get_thread_area(child, addr,
-					 (struct user_desc __user *) data);
+		ret = do_get_thread_area(child, addr, datap);
 		break;
 
 	case PTRACE_SET_THREAD_AREA:
 		if ((int) addr < 0)
 			return -EIO;
-		ret = do_set_thread_area(child, addr,
-					 (struct user_desc __user *) data, 0);
+		ret = do_set_thread_area(child, addr, datap, 0);
 		break;
 #endif
 
-- 
1.7.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ