public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] parisc: perf: return -EFAULT on error
@ 2016-12-08 11:32 Dan Carpenter
  2016-12-08 14:53 ` bojan prtvar
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2016-12-08 11:32 UTC (permalink / raw)
  To: James E.J. Bottomley; +Cc: Helge Deller, linux-parisc, kernel-janitors

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;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-12-10 20:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-08 11:32 [patch] parisc: perf: return -EFAULT on error Dan Carpenter
2016-12-08 14:53 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox