Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1363466 > unrolled thread
| Started by | Lee Jones <lee.jones@linaro.org> |
|---|---|
| First post | 2016-03-23 15:50 +0100 |
| Last post | 2016-03-23 15:50 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v2 3/5] mailbox: mailbox-test: Use more consistent format for calling copy_from_user() Lee Jones <lee.jones@linaro.org> - 2016-03-23 15:50 +0100
| From | Lee Jones <lee.jones@linaro.org> |
|---|---|
| Date | 2016-03-23 15:50 +0100 |
| Subject | [PATCH v2 3/5] mailbox: mailbox-test: Use more consistent format for calling copy_from_user() |
| Message-ID | <rfSgG-4NE-13@gated-at.bofh.it> |
While we're at it, ensure copy-to location is NULL'ed in the error path.
Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
drivers/mailbox/mailbox-test.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/mailbox/mailbox-test.c b/drivers/mailbox/mailbox-test.c
index dc11bbf..5f4b439 100644
--- a/drivers/mailbox/mailbox-test.c
+++ b/drivers/mailbox/mailbox-test.c
@@ -46,7 +46,6 @@ static ssize_t mbox_test_signal_write(struct file *filp,
size_t count, loff_t *ppos)
{
struct mbox_test_device *tdev = filp->private_data;
- int ret;
if (!tdev->tx_channel) {
dev_err(tdev->dev, "Channel cannot do Tx\n");
@@ -64,13 +63,13 @@ static ssize_t mbox_test_signal_write(struct file *filp,
if (!tdev->signal)
return -ENOMEM;
- ret = copy_from_user(tdev->signal, userbuf, count);
- if (ret) {
+ if (copy_from_user(tdev->signal, userbuf, count)) {
kfree(tdev->signal);
+ tdev->signal = NULL;
return -EFAULT;
}
- return ret < 0 ? ret : count;
+ return count;
}
static const struct file_operations mbox_test_signal_ops = {
--
1.9.1
Back to top | Article view | linux.kernel
csiph-web