mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Korty <joe.korty@ccur.com>
To: mingo@elte.hu, a.p.zijlstra@chello.nl, john.blackwood@ccur.com
Cc: linux-kernel@vger.kernel.org
Subject: [PERF EVENTS] fix incorrect copy_from_user usage
Date: Tue, 28 Sep 2010 18:03:11 -0400	[thread overview]
Message-ID: <20100928220311.GA18145@tsunami.ccur.com> (raw)

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)

             reply	other threads:[~2010-09-28 22:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-28 22:03 Joe Korty [this message]
2010-10-12 13:08 ` [tip:perf/urgent] perf: Fix incorrect copy_from_user() usage tip-bot for John Blackwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100928220311.GA18145@tsunami.ccur.com \
    --to=joe.korty@ccur.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=john.blackwood@ccur.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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