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  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]
Date:   Tue, 24 Jan 2017 11:22:11 +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 2/7] ALSA: seq: Delete unnecessary checks in
 snd_seq_ioctl_get_subscription()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Tue, 24 Jan 2017 08:54:36 +0100

Two checks were repeated by the snd_seq_ioctl_get_subscription() function
despite of pointer determinations for the used variables at the beginning.

* Adjust jump targets according to the Linux coding style convention.

* Convert an assignment for the variable "result" to a direct initialisation.

* Delete extra variable initialisations and the repeated checks
  which became unnecessary with this refactoring.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 sound/core/seq/seq_clientmgr.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index 594c341a193e..8e804ff784ed 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -1891,16 +1891,15 @@ static int snd_seq_ioctl_get_subscription(struct snd_seq_client *client,
 					  void *arg)
 {
 	struct snd_seq_port_subscribe *subs = arg;
-	int result;
-	struct snd_seq_client *sender = NULL;
-	struct snd_seq_client_port *sport = NULL;
+	int result = -EINVAL;
+	struct snd_seq_client *sender;
+	struct snd_seq_client_port *sport;
 	struct snd_seq_subscribers *p;
 
-	result = -EINVAL;
 	if ((sender = snd_seq_client_use_ptr(subs->sender.client)) == NULL)
-		goto __end;
+		goto exit;
 	if ((sport = snd_seq_port_use_ptr(sender, subs->sender.port)) == NULL)
-		goto __end;
+		goto unlock_client;
 	p = snd_seq_port_get_subscription(&sport->c_src, &subs->dest);
 	if (p) {
 		result = 0;
@@ -1908,12 +1907,10 @@ static int snd_seq_ioctl_get_subscription(struct snd_seq_client *client,
 	} else
 		result = -ENOENT;
 
-      __end:
-      	if (sport)
-		snd_seq_port_unlock(sport);
-	if (sender)
-		snd_seq_client_unlock(sender);
-
+	snd_seq_port_unlock(sport);
+unlock_client:
+	snd_seq_client_unlock(sender);
+exit:
 	return result;
 }
 
-- 
2.11.0

Powered by blists - more mailing lists