Skip to content

Commit 82cbd56

Browse files
Dan Carpenterhdeller
authored andcommitted
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>
1 parent 637250c commit 82cbd56

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎arch/parisc/kernel/perf.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,6 @@ static ssize_t perf_read(struct file *file, char __user *buf, size_t cnt, loff_t
301301
static ssize_t perf_write(struct file *file, const char __user *buf, size_t count,
302302
loff_t *ppos)
303303
{
304-
int err;
305304
size_t image_size;
306305
uint32_t image_type;
307306
uint32_t interface_type;
@@ -320,8 +319,8 @@ static ssize_t perf_write(struct file *file, const char __user *buf, size_t coun
320319
if (count != sizeof(uint32_t))
321320
return -EIO;
322321

323-
if ((err = copy_from_user(&image_type, buf, sizeof(uint32_t))) != 0)
324-
return err;
322+
if (copy_from_user(&image_type, buf, sizeof(uint32_t)))
323+
return -EFAULT;
325324

326325
/* Get the interface type and test type */
327326
interface_type = (image_type >> 16) & 0xffff;

0 commit comments

Comments
 (0)