Commit 82cbd568 authored by Dan Carpenter's avatar Dan Carpenter Committed by Helge Deller

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarHelge Deller <deller@gmx.de>
parent 637250cc
...@@ -301,7 +301,6 @@ static ssize_t perf_read(struct file *file, char __user *buf, size_t cnt, loff_t ...@@ -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, static ssize_t perf_write(struct file *file, const char __user *buf, size_t count,
loff_t *ppos) loff_t *ppos)
{ {
int err;
size_t image_size; size_t image_size;
uint32_t image_type; uint32_t image_type;
uint32_t interface_type; uint32_t interface_type;
...@@ -320,8 +319,8 @@ static ssize_t perf_write(struct file *file, const char __user *buf, size_t coun ...@@ -320,8 +319,8 @@ static ssize_t perf_write(struct file *file, const char __user *buf, size_t coun
if (count != sizeof(uint32_t)) if (count != sizeof(uint32_t))
return -EIO; return -EIO;
if ((err = copy_from_user(&image_type, buf, sizeof(uint32_t))) != 0) if (copy_from_user(&image_type, buf, sizeof(uint32_t)))
return err; return -EFAULT;
/* Get the interface type and test type */ /* Get the interface type and test type */
interface_type = (image_type >> 16) & 0xffff; interface_type = (image_type >> 16) & 0xffff;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment