[PATCH] prctl: return MCE process flags through pointer

From: Smith, GeoffX
Date: Tue Dec 22 2009 - 19:33:30 EST


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@xxxxxxxxx>


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;

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