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-next>] [day] [month] [year] [list]
Message-ID: <20210311044408.t6qut7taaagt4a63@kewl-virtual-machine>
Date:   Thu, 11 Mar 2021 10:14:08 +0530
From:   Shubhankar Kuranagatti <shubhankarvk@...il.com>
To:     davem@...emloft.net
Cc:     kuba@...nel.org, ast@...nel.org, daniel@...earbox.net,
        andrii@...nel.org, kafai@...com, songliubraving@...com, yhs@...com,
        john.fastabend@...il.com, kpsingh@...nel.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        bpf@...r.kernel.org, bkkarthik@...u.pes.edu
Subject: [PATCH] net: socket.c: Fix comparison issues

The constant has been placed to the right side of the test.

Signed-off-by: Shubhankar Kuranagatti <shubhankarvk@...il.com>
---
 net/socket.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/socket.c b/net/socket.c
index 84a8049c2b09..a23dd4348793 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1495,7 +1495,7 @@ int __sys_socket(int family, int type, int protocol)
 		return -EINVAL;
 	type &= SOCK_TYPE_MASK;
 
-	if (SOCK_NONBLOCK != O_NONBLOCK && (flags & SOCK_NONBLOCK))
+	if ((flags & SOCK_NONBLOCK) && SOCK_NONBLOCK != O_NONBLOCK)
 		flags = (flags & ~SOCK_NONBLOCK) | O_NONBLOCK;
 
 	retval = sock_create(family, type, protocol, &sock);
@@ -1526,7 +1526,7 @@ int __sys_socketpair(int family, int type, int protocol, int __user *usockvec)
 		return -EINVAL;
 	type &= SOCK_TYPE_MASK;
 
-	if (SOCK_NONBLOCK != O_NONBLOCK && (flags & SOCK_NONBLOCK))
+	if ((flags & SOCK_NONBLOCK) && SOCK_NONBLOCK != O_NONBLOCK)
 		flags = (flags & ~SOCK_NONBLOCK) | O_NONBLOCK;
 
 	/*
@@ -1693,7 +1693,7 @@ int __sys_accept4_file(struct file *file, unsigned file_flags,
 	if (flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK))
 		return -EINVAL;
 
-	if (SOCK_NONBLOCK != O_NONBLOCK && (flags & SOCK_NONBLOCK))
+	if ((flags & SOCK_NONBLOCK) && SOCK_NONBLOCK != O_NONBLOCK)
 		flags = (flags & ~SOCK_NONBLOCK) | O_NONBLOCK;
 
 	sock = sock_from_file(file);
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ