public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] prctl: return MCE process flags through pointer
@ 2009-12-23  0:33 Smith, GeoffX
  2009-12-23  1:14 ` Andi Kleen
  0 siblings, 1 reply; 11+ messages in thread
From: Smith, GeoffX @ 2009-12-23  0:33 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org
  Cc: andi@firstfloor.org, Andrew Morton, Michael Stone

This patch fixes the semantics of prctl() option PR_MCE_KILL_GET 
to pass the return value through *arg2.

With this change, the option now follows the same conventions as the
other "get" options added since 2.6.0, and also brings it into
conformance with the advice in chapter 16 of Documentation/CodingStyle.

This prctl() option was only added within the last month, so there are
not any production applications to break.  This patch applies cleanly
to mainline and to 2.6.32.2 for backporting.

Signed-off-by:  Geoff Smith <geoffx.smith@intel.com>


diff --git a/kernel/sys.c b/kernel/sys.c
index 26a6b73..347021a 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1570,13 +1570,16 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
 			error = 0;
 			break;
 		case PR_MCE_KILL_GET:
-			if (arg2 | arg3 | arg4 | arg5)
+			if (arg3 | arg4 | arg5)
 				return -EINVAL;
 			if (current->flags & PF_MCE_PROCESS)
-				error = (current->flags & PF_MCE_EARLY) ?
-					PR_MCE_KILL_EARLY : PR_MCE_KILL_LATE;
+				error = put_user(
+					(current->flags & PF_MCE_EARLY) ?
+					PR_MCE_KILL_EARLY : PR_MCE_KILL_LATE,
+					(unsigned long __user *)arg2);
 			else
-				error = PR_MCE_KILL_DEFAULT;
+				error = put_user(PR_MCE_KILL_DEFAULT,
+					(unsigned long __user *)arg2);
 			break;
 		default:
 			error = -EINVAL;
 				return -EINVAL;


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-12-25  8:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-23  0:33 [PATCH] prctl: return MCE process flags through pointer Smith, GeoffX
2009-12-23  1:14 ` Andi Kleen
2009-12-23  1:34   ` Andrew Morton
2009-12-23  9:52     ` Andi Kleen
2009-12-23 10:18       ` Andrew Morton
2009-12-23 17:56         ` Smith, GeoffX
2009-12-23 18:54           ` Andrew Morton
2009-12-23 20:24             ` Smith, GeoffX
2009-12-25  8:35             ` Arjan van de Ven
2009-12-23 19:31           ` Andi Kleen
2009-12-25  8:30         ` Arjan van de Ven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox