Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1309051 > unrolled thread

[PATCH 1/4] mailbox: mailbox-test: Use more consistent format for calling copy_from_user()

Started byLee Jones <lee.jones@linaro.org>
First post2016-01-14 08:20 +0100
Last post2016-01-14 08:20 +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.


Contents

  [PATCH 1/4] mailbox: mailbox-test: Use more consistent format for calling copy_from_user() Lee Jones <lee.jones@linaro.org> - 2016-01-14 08:20 +0100

#1309051 — [PATCH 1/4] mailbox: mailbox-test: Use more consistent format for calling copy_from_user()

FromLee Jones <lee.jones@linaro.org>
Date2016-01-14 08:20 +0100
Subject[PATCH 1/4] mailbox: mailbox-test: Use more consistent format for calling copy_from_user()
Message-ID<qQKml-3Em-1@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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mailbox/mailbox-test.c b/drivers/mailbox/mailbox-test.c
index 684ae17..7d9b915 100644
--- a/drivers/mailbox/mailbox-test.c
+++ b/drivers/mailbox/mailbox-test.c
@@ -63,9 +63,9 @@ 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;
 	}
 
-- 
1.9.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web