Commit ad0cf3478de8677f720ee06393b3147819568d6a

Authored by John Blackwood
Committed by Ingo Molnar
1 parent 29979aa8bd

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>

Showing 1 changed file with 1 additions and 3 deletions Side-by-side Diff

... ... @@ -2202,15 +2202,13 @@
2202 2202 static int perf_event_period(struct perf_event *event, u64 __user *arg)
2203 2203 {
2204 2204 struct perf_event_context *ctx = event->ctx;
2205   - unsigned long size;
2206 2205 int ret = 0;
2207 2206 u64 value;
2208 2207  
2209 2208 if (!event->attr.sample_period)
2210 2209 return -EINVAL;
2211 2210  
2212   - size = copy_from_user(&value, arg, sizeof(value));
2213   - if (size != sizeof(value))
  2211 + if (copy_from_user(&value, arg, sizeof(value)))
2214 2212 return -EFAULT;
2215 2213  
2216 2214 if (!value)