[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <99fa9b19-143b-1d11-755a-a1de606b6953@users.sourceforge.net>
Date: Sat, 21 Jan 2017 19:14:37 +0100
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: linux-s390@...r.kernel.org,
Gerald Schäfer <gerald.schaefer@...ibm.com>,
Heiko Carstens <heiko.carstens@...ibm.com>,
Martin Schwidefsky <schwidefsky@...ibm.com>,
Sebastian Ott <sebott@...ux.vnet.ibm.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: [PATCH 5/5] s390/pci: Move two assignments for the variable "ret" in
get_pfn()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sat, 21 Jan 2017 18:48:45 +0100
A local variable was set to an error code in two cases before a concrete
error situation was detected. Thus move the corresponding assignments into
if branches 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/s390/pci/pci_mmio.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch/s390/pci/pci_mmio.c b/arch/s390/pci/pci_mmio.c
index f125858a77e9..400af13ef275 100644
--- a/arch/s390/pci/pci_mmio.c
+++ b/arch/s390/pci/pci_mmio.c
@@ -18,13 +18,15 @@ static long get_pfn(unsigned long user_addr, unsigned long access,
long ret;
down_read(¤t->mm->mmap_sem);
- ret = -EINVAL;
vma = find_vma(current->mm, user_addr);
- if (!vma)
+ if (!vma) {
+ ret = -EINVAL;
goto out;
- ret = -EACCES;
- if (!(vma->vm_flags & access))
+ }
+ if (!(vma->vm_flags & access)) {
+ ret = -EACCES;
goto out;
+ }
ret = follow_pfn(vma, user_addr, pfn);
out:
up_read(¤t->mm->mmap_sem);
--
2.11.0
Powered by blists - more mailing lists