Commit ad0cf347 authored by John Blackwood's avatar John Blackwood Committed by Ingo Molnar

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: default avatarJoe Korty <joe.korty@ccur.com>
Acked-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20100928220311.GA18145@tsunami.ccur.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 29979aa8
...@@ -2202,15 +2202,13 @@ static void perf_event_for_each(struct perf_event *event, ...@@ -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) static int perf_event_period(struct perf_event *event, u64 __user *arg)
{ {
struct perf_event_context *ctx = event->ctx; struct perf_event_context *ctx = event->ctx;
unsigned long size;
int ret = 0; int ret = 0;
u64 value; u64 value;
if (!event->attr.sample_period) if (!event->attr.sample_period)
return -EINVAL; return -EINVAL;
size = copy_from_user(&value, arg, sizeof(value)); if (copy_from_user(&value, arg, sizeof(value)))
if (size != sizeof(value))
return -EFAULT; return -EFAULT;
if (!value) if (!value)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment