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: <b4d0b274-23ac-4369-7119-a77e5108578b@users.sourceforge.net>
Date:   Tue, 24 Jan 2017 11:26:15 +0100
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     alsa-devel@...a-project.org, Clemens Ladisch <clemens@...isch.de>,
        Jaroslav Kysela <perex@...ex.cz>,
        Martin Koegler <martin.koegler@...llo.at>,
        Takashi Iwai <tiwai@...e.com>,
        Takashi Sakamoto <o-takashi@...amocchi.jp>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: [PATCH 6/7] dmasound_core: Move two assignments for the variable
 "ret" in state_open()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Tue, 24 Jan 2017 10:05:29 +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>
---
 sound/oss/dmasound/dmasound_core.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c
index f4ee85a4c42f..2bdd1d619a7f 100644
--- a/sound/oss/dmasound/dmasound_core.c
+++ b/sound/oss/dmasound/dmasound_core.c
@@ -1269,13 +1269,15 @@ static int state_open(struct inode *inode, struct file *file)
 	int ret;
 
 	mutex_lock(&dmasound_core_mutex);
-	ret = -EBUSY;
-	if (state.busy)
+	if (state.busy) {
+		ret = -EBUSY;
 		goto out;
+	}
 
-	ret = -ENODEV;
-	if (!try_module_get(dmasound.mach.owner))
+	if (!try_module_get(dmasound.mach.owner)) {
+		ret = -ENODEV;
 		goto out;
+	}
 
 	state.ptr = 0;
 	state.busy = 1;
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ