summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorJohn Blackwood <john.blackwood@ccur.com>2010-09-28 18:03:11 -0400
committerIngo Molnar <mingo@elte.hu>2010-10-12 11:45:01 +0200
commitad0cf3478de8677f720ee06393b3147819568d6a (patch)
treecd007170b0f20f724924ff53897bf534847e14c4 /kernel
parent29979aa8bd69becd94cbad59093807a417ce2a9e (diff)
downloadop-kernel-dev-ad0cf3478de8677f720ee06393b3147819568d6a.zip
op-kernel-dev-ad0cf3478de8677f720ee06393b3147819568d6a.tar.gz
perf: Fix incorrect copy_from_user() usage
perf events: repair incorrect use of copy_from_user This makes the perf_event_period() return 0 instead of -EFAULT on success. Signed-off-by: John Blackwood<john.blackwood@ccur.com> Signed-off-by: Joe Korty <joe.korty@ccur.com> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <20100928220311.GA18145@tsunami.ccur.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/perf_event.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index db5b560..b98bed3 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -2202,15 +2202,13 @@ static void perf_event_for_each(struct perf_event *event,
static int perf_event_period(struct perf_event *event, u64 __user *arg)
{
struct perf_event_context *ctx = event->ctx;
- unsigned long size;
int ret = 0;
u64 value;
if (!event->attr.sample_period)
return -EINVAL;
- size = copy_from_user(&value, arg, sizeof(value));
- if (size != sizeof(value))
+ if (copy_from_user(&value, arg, sizeof(value)))
return -EFAULT;
if (!value)
OpenPOWER on IntegriCloud