lkml.org 
[lkml]   [2009]   [Dec]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH] prctl: return MCE process flags through pointer
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;


\
 
 \ /
  Last update: 2009-12-23 01:35    [W:0.046 / U:0.644 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site