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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <ba4807c5a548af355d9c34a9f19c92e993acbb12.1444302968.git.sergei@s15v.net>
Date:	Thu,  8 Oct 2015 14:31:57 +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 28/44] kdbus: Cleanup kdbus_queue_entry_new()

Remove separate exit point as the only error case in the function is
when kdbus_staging_emit() fails. Assign a slice to temporary var first
to not clear it explicitly on error and to return an error code without
`ret' variable.

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

diff --git a/ipc/kdbus/queue.c b/ipc/kdbus/queue.c
index 90e8d16f5967..3c0fb3bb55da 100644
--- a/ipc/kdbus/queue.c
+++ b/ipc/kdbus/queue.c
@@ -185,7 +185,7 @@ struct kdbus_queue_entry *kdbus_queue_entry_new(struct kdbus_conn *src,
 						struct kdbus_staging *s)
 {
 	struct kdbus_queue_entry *entry;
-	int ret;
+	struct kdbus_pool_slice *slice;
 
 	entry = kzalloc(sizeof(*entry), GFP_KERNEL);
 	if (!entry)
@@ -196,19 +196,15 @@ struct kdbus_queue_entry *kdbus_queue_entry_new(struct kdbus_conn *src,
 	entry->conn = kdbus_conn_ref(dst);
 	entry->gaps = kdbus_gaps_ref(s->gaps);
 
-	entry->slice = kdbus_staging_emit(s, src, dst);
-	if (IS_ERR(entry->slice)) {
-		ret = PTR_ERR(entry->slice);
-		entry->slice = NULL;
-		goto error;
+	slice = kdbus_staging_emit(s, src, dst);
+	if (IS_ERR(slice)) {
+		kdbus_queue_entry_free(entry);
+		return ERR_CAST(slice);
 	}
 
+	entry->slice = slice;
 	entry->user = src ? kdbus_user_ref(src->user) : NULL;
 	return entry;
-
-error:
-	kdbus_queue_entry_free(entry);
-	return ERR_PTR(ret);
 }
 
 /**
-- 
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