lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d8178ea8-8a46-b922-c486-d741dd916565@users.sourceforge.net>
Date:   Sat, 21 Jan 2017 19:12:27 +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 3/5] s390/pci: Move three assignments for the variable "rc" in
 clp_normal_command()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sat, 21 Jan 2017 18:10:57 +0100

A local variable was set to an error code 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_clp.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/s390/pci/pci_clp.c b/arch/s390/pci/pci_clp.c
index 28e13fa7a79c..bde0291cc724 100644
--- a/arch/s390/pci/pci_clp.c
+++ b/arch/s390/pci/pci_clp.c
@@ -521,14 +521,16 @@ static int clp_normal_command(struct clp_req *req)
 	if (!lpcb)
 		return -ENOMEM;
 
-	rc = -EFAULT;
 	uptr = (void __force __user *)(unsigned long) req->data_p;
-	if (copy_from_user(lpcb, uptr, PAGE_SIZE) != 0)
+	if (copy_from_user(lpcb, uptr, PAGE_SIZE) != 0) {
+		rc = -EFAULT;
 		goto out_free;
+	}
 
-	rc = -EINVAL;
-	if (lpcb->fmt != 0 || lpcb->reserved1 != 0 || lpcb->reserved2 != 0)
+	if (lpcb->fmt != 0 || lpcb->reserved1 != 0 || lpcb->reserved2 != 0) {
+		rc = -EINVAL;
 		goto out_free;
+	}
 
 	switch (req->lps) {
 	case 0:
@@ -541,9 +543,8 @@ static int clp_normal_command(struct clp_req *req)
 	if (rc)
 		goto out_free;
 
-	rc = -EFAULT;
 	if (copy_to_user(uptr, lpcb, PAGE_SIZE) != 0)
-		goto out_free;
+		rc = -EFAULT;
 
 	rc = 0;
 
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ