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, 11 Aug 2020 11:55:04 +0200
From:   Stefano Garzarella <sgarzare@...hat.com>
To:     davem@...emloft.net
Cc:     Jorgen Hansen <jhansen@...are.com>,
        Stefano Garzarella <sgarzare@...hat.com>,
        netdev@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
        Dexuan Cui <decui@...rosoft.com>, linux-kernel@...r.kernel.org,
        Stefan Hajnoczi <stefanha@...hat.com>
Subject: [PATCH net 2/2] vsock: small cleanup in vsock_poll()

This patch combines nested if statements in a single one to reduce
the indentation in vsock_poll().
It also combines an if nested in the else branch.

The behavior isn't changed.

Signed-off-by: Stefano Garzarella <sgarzare@...hat.com>
---
 net/vmw_vsock/af_vsock.c | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index 9e93bc201cc0..2c80dc14fa60 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -1032,21 +1032,18 @@ static __poll_t vsock_poll(struct file *file, struct socket *sock,
 		}
 
 		/* Connected sockets that can produce data can be written. */
-		if (transport && sk->sk_state == TCP_ESTABLISHED) {
-			if (!(sk->sk_shutdown & SEND_SHUTDOWN)) {
-				bool space_avail_now = false;
-				int ret = transport->notify_poll_out(
-						vsk, 1, &space_avail_now);
-				if (ret < 0) {
-					mask |= EPOLLERR;
-				} else {
-					if (space_avail_now)
-						/* Remove EPOLLWRBAND since INET
-						 * sockets are not setting it.
-						 */
-						mask |= EPOLLOUT | EPOLLWRNORM;
-
-				}
+		if (transport && sk->sk_state == TCP_ESTABLISHED &&
+		    !(sk->sk_shutdown & SEND_SHUTDOWN)) {
+			bool space_avail_now = false;
+			int ret = transport->notify_poll_out(vsk, 1,
+							     &space_avail_now);
+			if (ret < 0) {
+				mask |= EPOLLERR;
+			} else if (space_avail_now) {
+				/* Remove EPOLLWRBAND since INET
+				 * sockets are not setting it.
+				 */
+				mask |= EPOLLOUT | EPOLLWRNORM;
 			}
 		}
 
-- 
2.26.2

Powered by blists - more mailing lists