parisc: perf: return -EFAULT on error
Subsystems (2)
PATCH 1/1 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.
arch/parisc/kernel/perf.c +2 -2
@@ -320,8 +320,8 @@ static ssize_t perf_write(struct file *file, const char __user *buf, size_t counif (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 ;
Hi Dan,
arch/parisc/kernel/perf.c static ssize_t perf_write(struct file *file, const char __user *buf, size_t coun · line 324
Quoted 2 lines · Dan Carpenter
arch/parisc/kernel/perf.c +0
-2-if ((err =copy_from_user (&image_type, buf,sizeof (uint32_t ))) !=0 ) -return err;
Why not delete err?
Regards,
Bojan
Quoted 7 lines · bojan prtvar
Hi Dan,
arch/parisc/kernel/perf.c static ssize_t perf_write(struct file *file, const char __user *buf, size_t coun · line 324
Quoted 2 lines · Dan Carpenter
arch/parisc/kernel/perf.c +0
-2-if ((err =copy_from_user (&image_type, buf,sizeof (uint32_t ))) !=0 ) -return err;Why not delete err?
Gar... I'm sorry. I'll resend.
regards,
dan carpenter
PATCH v2 1/1 parisc: perf: return -EFAULT on error
In reply to bojan prtvarThe copy_from_user() returns the number of bytes remaining to be copied but we want to return -EFAULT if it's non-zero.
---
v2: Fix unused variable warning. Thanks, Bojan.
arch/parisc/kernel/perf.c +2 -3
@@ -301,7 +301,6 @@ static ssize_t perf_read(struct file *file, char __user *buf, size_t cnt, loff_tstatic 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 counif (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 ;
Helge Deller
maintainerQuoted 4 lines · Dan Carpenter
The
copy_from_user()returns the number of bytes remaining to be copied but we want to return-EFAULTif it's non-zero.Signed-off-by Dan Carpenter <[email protected]>
Thanks Dan!
I'll add it to my next push request for the parisc architecture.
Helge
Quoted 31 lines
---
v2: Fix unused variable warning. Thanks, Bojan.arch/parisc/kernel/perf.c +2
-4@@ -301,7 +301,6 @@ static ssize_t perf_read(struct file *file, char __user *buf, size_t cnt, loff_tstatic 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 counif (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 ; --To unsubscribe from this list: send the line "unsubscribe linux-parisc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html