mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PERF EVENTS] fix incorrect copy_from_user usage
@ 2010-09-28 22:03 Joe Korty
  2010-10-12 13:08 ` [tip:perf/urgent] perf: Fix incorrect copy_from_user() usage tip-bot for John Blackwood
  0 siblings, 1 reply; 2+ messages in thread
From: Joe Korty @ 2010-09-28 22:03 UTC (permalink / raw)
  To: mingo, a.p.zijlstra, john.blackwood; +Cc: linux-kernel

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@ccur.com>
Signed-off-by: Joe Korty <joe.korty@ccur.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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [tip:perf/urgent] perf: Fix incorrect copy_from_user() usage
  2010-09-28 22:03 [PERF EVENTS] fix incorrect copy_from_user usage Joe Korty
@ 2010-10-12 13:08 ` tip-bot for John Blackwood
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for John Blackwood @ 2010-10-12 13:08 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, joe.korty, tglx,
	john.blackwood, mingo

Commit-ID:  ad0cf3478de8677f720ee06393b3147819568d6a
Gitweb:     http://git.kernel.org/tip/ad0cf3478de8677f720ee06393b3147819568d6a
Author:     John Blackwood <john.blackwood@ccur.com>
AuthorDate: Tue, 28 Sep 2010 18:03:11 -0400
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 12 Oct 2010 11:45:01 +0200

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>
---
 kernel/perf_event.c |    4 +---
 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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-12 13:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-28 22:03 [PERF EVENTS] fix incorrect copy_from_user usage Joe Korty
2010-10-12 13:08 ` [tip:perf/urgent] perf: Fix incorrect copy_from_user() usage tip-bot for John Blackwood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome