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: <7b9555b4d35ac00cb80881bb61b9fd619f393e8d.1444302968.git.sergei@s15v.net>
Date:	Thu,  8 Oct 2015 14:31:53 +0300
From:	Sergei Zviagintsev <sergei@...v.net>
To:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Daniel Mack <daniel@...que.org>,
	David Herrmann <dh.herrmann@...glemail.com>,
	Djalal Harouni <tixxdz@...ndz.org>
Cc:	linux-kernel@...r.kernel.org, Sergei Zviagintsev <sergei@...v.net>
Subject: [PATCH 24/44] kdbus: Cleanup kdbus_conn_unicast()

Do not initialize `name' and `ret' as values are assigned to them at
the first use by kdbus_pin_dst(). Simplify handling of
kdbus_conn_entry_insert() return value and drop useless goto.

Signed-off-by: Sergei Zviagintsev <sergei@...v.net>
---
 ipc/kdbus/connection.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/ipc/kdbus/connection.c b/ipc/kdbus/connection.c
index db49f282a1bf..b3c5f20a57d8 100644
--- a/ipc/kdbus/connection.c
+++ b/ipc/kdbus/connection.c
@@ -1229,12 +1229,12 @@ static int kdbus_conn_unicast(struct kdbus_conn *src,
 			      struct kdbus_staging *staging)
 {
 	const struct kdbus_msg *msg = staging->msg;
-	struct kdbus_name_entry *name = NULL;
+	struct kdbus_name_entry *name;
 	struct kdbus_reply *wait = NULL;
 	struct kdbus_conn *dst = NULL;
 	struct kdbus_bus *bus = src->ep->bus;
 	bool is_signal = (msg->flags & KDBUS_MSG_SIGNAL);
-	int ret = 0;
+	int ret;
 
 	if (WARN_ON(msg->dst_id == KDBUS_DST_ID_BROADCAST) ||
 	    WARN_ON(!(msg->flags & KDBUS_MSG_EXPECT_REPLY) &&
@@ -1245,7 +1245,6 @@ static int kdbus_conn_unicast(struct kdbus_conn *src,
 	down_read(&bus->name_registry->rwlock);
 
 	/* find and pin destination */
-
 	ret = kdbus_pin_dst(bus, staging, &name, &dst);
 	if (ret < 0)
 		goto exit;
@@ -1276,11 +1275,10 @@ static int kdbus_conn_unicast(struct kdbus_conn *src,
 		kdbus_bus_eavesdrop(bus, src, staging);
 
 	ret = kdbus_conn_entry_insert(src, dst, staging, wait, name);
-	if (ret < 0 && !is_signal)
-		goto exit;
 
 	/* signals are treated like broadcasts, recv-errors are ignored */
-	ret = 0;
+	if (is_signal)
+		ret = 0;
 
 exit:
 	up_read(&bus->name_registry->rwlock);
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ