[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100928220311.GA18145@tsunami.ccur.com>
Date: Tue, 28 Sep 2010 18:03:11 -0400
From: Joe Korty <joe.korty@...r.com>
To: mingo@...e.hu, a.p.zijlstra@...llo.nl, john.blackwood@...r.com
Cc: linux-kernel@...r.kernel.org
Subject: [PERF EVENTS] 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.
Developed-by: John Blackwood <john.blackwood@...r.com>
Signed-off-by: Joe Korty <joe.korty@...r.com>
Index: 2.6.36-rc5/kernel/perf_event.c
===================================================================
--- 2.6.36-rc5.orig/kernel/perf_event.c 2010-09-28 17:38:16.000000000 -0400
+++ 2.6.36-rc5/kernel/perf_event.c 2010-09-28 17:48:10.000000000 -0400
@@ -2202,15 +2202,13 @@
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)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists