All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Input: edt-ft5x06 - return -EFAULT on copy_to_user() error
@ 2012-09-17  5:12 Axel Lin
  0 siblings, 0 replies; only message in thread
From: Axel Lin @ 2012-09-17  5:12 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Simon Budig, Henrik Rydberg, linux-input

copy_to_user() returns the number of bytes remaining, but we want a
negative error code here.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/input/touchscreen/edt-ft5x06.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index bf00b32..02e9dab 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -567,7 +567,9 @@ static ssize_t edt_ft5x06_debugfs_raw_data_read(struct file *file,
 
 	read = min_t(size_t, count, tsdata->raw_bufsize - *off);
 	error = copy_to_user(buf, tsdata->raw_buffer + *off, read);
-	if (!error)
+	if (error)
+		error = -EFAULT;
+	else
 		*off += read;
 out:
 	mutex_unlock(&tsdata->mutex);
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-09-17  5:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-17  5:12 [PATCH] Input: edt-ft5x06 - return -EFAULT on copy_to_user() error Axel Lin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.