From: Dan Carpenter <dan.carpenter@oracle.com>
To: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>,
linux-parisc@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] parisc: perf: return -EFAULT on error
Date: Thu, 08 Dec 2016 11:32:00 +0000 [thread overview]
Message-ID: <20161208113200.GC11382@elgon.mountain> (raw)
The copy_from_user() returns the number of bytes remaining to be copied
but we want to return -EFAULT if it's non-zero.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/arch/parisc/kernel/perf.c b/arch/parisc/kernel/perf.c
index 518f4f5f1f43..76c96a53fc71 100644
--- a/arch/parisc/kernel/perf.c
+++ b/arch/parisc/kernel/perf.c
@@ -320,8 +320,8 @@ static ssize_t perf_write(struct file *file, const char __user *buf, size_t coun
if (count != sizeof(uint32_t))
return -EIO;
- if ((err = copy_from_user(&image_type, buf, sizeof(uint32_t))) != 0)
- return err;
+ if (copy_from_user(&image_type, buf, sizeof(uint32_t)))
+ return -EFAULT;
/* Get the interface type and test type */
interface_type = (image_type >> 16) & 0xffff;
next reply other threads:[~2016-12-08 11:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-08 11:32 Dan Carpenter [this message]
2016-12-08 14:53 ` [patch] parisc: perf: return -EFAULT on error bojan prtvar
2016-12-08 15:10 ` Dan Carpenter
2016-12-10 9:06 ` [patch v2] " Dan Carpenter
2016-12-10 20:40 ` Helge Deller
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=20161208113200.GC11382@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=deller@gmx.de \
--cc=jejb@parisc-linux.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
/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