summaryrefslogtreecommitdiffstats
path: root/arch/parisc
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2016-12-10 10:06:25 +0100
committerHelge Deller <deller@gmx.de>2016-12-12 22:29:49 +0100
commit82cbd568bc5aa4c70f2a694f169d39ddef3b1aba (patch)
tree43ab29e0d4c9809724600db8b7dc0033c84fb52f /arch/parisc
parentparisc: Enhance CPU detection code on PAT machines (diff)
downloadlinux-82cbd568bc5aa4c70f2a694f169d39ddef3b1aba.tar.xz
linux-82cbd568bc5aa4c70f2a694f169d39ddef3b1aba.zip
parisc: perf: return -EFAULT on error
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> Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'arch/parisc')
-rw-r--r--arch/parisc/kernel/perf.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/parisc/kernel/perf.c b/arch/parisc/kernel/perf.c
index 518f4f5f1f43..6eabce62463b 100644
--- a/arch/parisc/kernel/perf.c
+++ b/arch/parisc/kernel/perf.c
@@ -301,7 +301,6 @@ static ssize_t perf_read(struct file *file, char __user *buf, size_t cnt, loff_t
static ssize_t perf_write(struct file *file, const char __user *buf, size_t count,
loff_t *ppos)
{
- int err;
size_t image_size;
uint32_t image_type;
uint32_t interface_type;
@@ -320,8 +319,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;