[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dcaccc31-99ac-ef90-cbef-79dbf72f0a4d@users.sourceforge.net>
Date: Thu, 19 Jan 2017 17:56:35 +0100
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: linuxppc-dev@...ts.ozlabs.org,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Daniel Axtens <dja@...ens.net>,
Geliang Tang <geliangtang@....com>,
Michael Ellerman <mpe@...erman.id.au>,
Nathan Fontenot <nfont@...ux.vnet.ibm.com>,
Pan Xinhui <xinhui.pan@...ux.vnet.ibm.com>,
Paul Gortmaker <paul.gortmaker@...driver.com>,
Paul Mackerras <paulus@...ba.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: [PATCH 3/8] powerpc/nvram: Move an assignment for the variable "ret"
in dev_nvram_write()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Thu, 19 Jan 2017 15:55:36 +0100
A local variable was set to an error code before a concrete error situation
was detected. Thus move the corresponding assignment into an if branch
to indicate a software failure there.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
arch/powerpc/kernel/nvram_64.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index cf839adf3aa7..dc90a0e9ad65 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -806,9 +806,10 @@ static ssize_t dev_nvram_write(struct file *file, const char __user *buf,
if (!tmp)
return -ENOMEM;
- ret = -EFAULT;
- if (copy_from_user(tmp, buf, count))
+ if (copy_from_user(tmp, buf, count)) {
+ ret = -EFAULT;
goto out;
+ }
ret = ppc_md.nvram_write(tmp, count, ppos);
--
2.11.0
Powered by blists - more mailing lists