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: <71c2d1fea4ee6858de74fed74012d78e57596fdd.1444302968.git.sergei@s15v.net>
Date:	Thu,  8 Oct 2015 14:31:54 +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 25/44] kdbus: Cleanup kdbus_cmd_conn_info()

 - Move `entry' and `owner' to the scope where they are used. Drop
   redundand initialization of `entry'. Use conditional operator to set
   the value of `owner'.

 - Set `ret' to zero right after call to kdbus_pool_slice_copy_kvec(),
   not in the end of function.

 - Remove redundant goto.

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

diff --git a/ipc/kdbus/connection.c b/ipc/kdbus/connection.c
index b3c5f20a57d8..6a73ac3f444d 100644
--- a/ipc/kdbus/connection.c
+++ b/ipc/kdbus/connection.c
@@ -1702,8 +1702,6 @@ int kdbus_cmd_conn_info(struct kdbus_conn *conn, void __user *argp)
 {
 	struct kdbus_meta_conn *conn_meta = NULL;
 	struct kdbus_pool_slice *slice = NULL;
-	struct kdbus_name_entry *entry = NULL;
-	struct kdbus_name_owner *owner = NULL;
 	struct kdbus_conn *owner_conn = NULL;
 	struct kdbus_item *meta_items = NULL;
 	struct kdbus_info info = {};
@@ -1739,9 +1737,12 @@ int kdbus_cmd_conn_info(struct kdbus_conn *conn, void __user *argp)
 	name = argv[1].item ? argv[1].item->str : NULL;
 
 	if (name) {
+		struct kdbus_name_entry *entry;
+		struct kdbus_name_owner *owner;
+
 		entry = kdbus_name_lookup_unlocked(bus->name_registry, name);
-		if (entry)
-			owner = kdbus_name_get_owner(entry);
+		owner = entry ? kdbus_name_get_owner(entry) : NULL;
+
 		if (!owner ||
 		    !kdbus_conn_policy_see_name(conn, current_cred(), name) ||
 		    (cmd->id != 0 && owner->conn->id != cmd->id)) {
@@ -1804,17 +1805,14 @@ int kdbus_cmd_conn_info(struct kdbus_conn *conn, void __user *argp)
 	ret = kdbus_pool_slice_copy_kvec(slice, 0, kvec, cnt, size);
 	if (ret < 0)
 		goto exit;
+	ret = 0;
 
 	kdbus_pool_slice_publish(slice, &cmd->offset, &cmd->info_size);
 
 	if (kdbus_member_set_user(&cmd->offset, argp, typeof(*cmd), offset) ||
 	    kdbus_member_set_user(&cmd->info_size, argp,
-				  typeof(*cmd), info_size)) {
+				  typeof(*cmd), info_size))
 		ret = -EFAULT;
-		goto exit;
-	}
-
-	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