[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b5dc24f8-4b74-9dfe-fb18-7dc0699b87ec@users.sourceforge.net>
Date: Thu, 19 Jan 2017 17:57:37 +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 4/8] powerpc/nvram: Return directly after a failed parameter
validation in dev_nvram_read()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Thu, 19 Jan 2017 16:12:48 +0100
* Return directly after an inappropriate input parameter was detected.
* Delete an initialisation for the variable "tmp" at the beginning
which became unnecessary with this refactoring.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
arch/powerpc/kernel/nvram_64.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index dc90a0e9ad65..463551589b97 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -745,24 +745,18 @@ static ssize_t dev_nvram_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
ssize_t ret;
- char *tmp = NULL;
+ char *tmp;
ssize_t size;
- if (!ppc_md.nvram_size) {
- ret = -ENODEV;
- goto out;
- }
+ if (!ppc_md.nvram_size)
+ return -ENODEV;
size = ppc_md.nvram_size();
- if (size < 0) {
- ret = size;
- goto out;
- }
+ if (size < 0)
+ return size;
- if (*ppos >= size) {
- ret = 0;
- goto out;
- }
+ if (*ppos >= size)
+ return 0;
count = min_t(size_t, count, size - *ppos);
count = min(count, PAGE_SIZE);
--
2.11.0
Powered by blists - more mailing lists