From: Axel Lin <axel.lin@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Simon Budig <simon.budig@kernelconcepts.de>,
Henrik Rydberg <rydberg@euromail.se>,
linux-input@vger.kernel.org
Subject: [PATCH] Input: edt-ft5x06 - return -EFAULT on copy_to_user() error
Date: Mon, 17 Sep 2012 13:12:52 +0800 [thread overview]
Message-ID: <1347858772.8376.1.camel@phoenix> (raw)
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
reply other threads:[~2012-09-17 5:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1347858772.8376.1.camel@phoenix \
--to=axel.lin@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=rydberg@euromail.se \
--cc=simon.budig@kernelconcepts.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox