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


Groups > linux.kernel > #1309051

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

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Lee Jones <lee.jones@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 1/4] mailbox: mailbox-test: Use more consistent format for calling copy_from_user()
Date Thu, 14 Jan 2016 08:20:01 +0100
Message-ID <qQKml-3Em-1@gated-at.bofh.it> (permalink)
References <qQKml-3Em-3@gated-at.bofh.it>
X-Original-To linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9HSLL4YJUaaHfmQ4+JCQ5axhgdYlZhCh6tKXBDNI0t8=; b=PcDMqkCV4slNab6Q7ZOlI/4ukZgDF+jz9w8e/eeWEwvjZa+ORIU+oV2ig+spe55dM2 rMW8Hfr3QpJEK6+9GsOg8Nw4yzWjzvQDA+c9Px6oI94o3upL+w7FwMJcUAAcaN3hxlRq hvJhAx2uRBaTt95+G8lPi3Nhfzv4iT7tzeBAs=
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9HSLL4YJUaaHfmQ4+JCQ5axhgdYlZhCh6tKXBDNI0t8=; b=HTJ4yz8agEHLG+5chEsBffHBwZ6y2PgreaIBk1ZO+1EkB34NH2Yaae8CHuGDazrb4I Vo0zGQEmpDxSJIjrKUmFtcDvBea/AxlRdD5r9wDDMKvVSYo4lL4icVom5squ6rTsgFf+ pVeUcgMp/pzmlkyRvzZtOFuBYrczBiapRIWdpD38y70Sn8Qjvv9JshJWmrAxFqWRq6eW MbfguRSc1Rds1g/QlZBU35mKFNpbkFpqT39TMZsfsbXnEgIxQ1j2wcTCMrqGGIulqYjO Hct/8fq1oFOMPEk3qMTm420ldMnnKwzvyK2zIeudVglls+bRplxOpvgvc6dIKLY31sMz iGVA==
X-Gm-Message-State ALoCoQny0wBGhLfVmYdSC9sFBG3fU3av1QNc3bAJ/Z1JB6Ld2VF70lmhLFwTQbGubMRi63cga6ddwP8+QHSYBwXowfrZeqMiEQ==
X-Received by 10.194.203.228 with SMTP id kt4mr2244455wjc.58.1452755618219; Wed, 13 Jan 2016 23:13:38 -0800 (PST)
X-Mailer git-send-email 1.9.1
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 26
Organization linux.* mail to news gateway
X-Original-Cc kernel@stlinux.com, maxime.coquelin@st.com, jassisinghbrar@gmail.com, dan.carpenter@oracle.com, seraphin.bonnaffe@st.com, Lee Jones <lee.jones@linaro.org>
X-Original-Date Thu, 14 Jan 2016 07:11:26 +0000
X-Original-Message-ID <1452755489-18736-2-git-send-email-lee.jones@linaro.org>
X-Original-References <1452755489-18736-1-git-send-email-lee.jones@linaro.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1309051

Show key headers only | View raw


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

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[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

csiph-web