All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: socket.c: Fix comparison issues
@ 2021-03-11  4:44 Shubhankar Kuranagatti
  2021-03-12  4:05 ` Xie He
  0 siblings, 1 reply; 2+ messages in thread
From: Shubhankar Kuranagatti @ 2021-03-11  4:44 UTC (permalink / raw)
  To: davem
  Cc: kuba, ast, daniel, andrii, kafai, songliubraving, yhs,
	john.fastabend, kpsingh, netdev, linux-kernel, bpf, bkkarthik

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

Signed-off-by: Shubhankar Kuranagatti <shubhankarvk@gmail.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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: socket.c: Fix comparison issues
  2021-03-11  4:44 [PATCH] net: socket.c: Fix comparison issues Shubhankar Kuranagatti
@ 2021-03-12  4:05 ` Xie He
  0 siblings, 0 replies; 2+ messages in thread
From: Xie He @ 2021-03-12  4:05 UTC (permalink / raw)
  To: Shubhankar Kuranagatti
  Cc: davem, kuba, ast, daniel, andrii, kafai, songliubraving, yhs,
	john.fastabend, kpsingh, netdev, linux-kernel, bpf, bkkarthik

What is the reason for this change? Why is the new way better than the
old way?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-12  4:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-11  4:44 [PATCH] net: socket.c: Fix comparison issues Shubhankar Kuranagatti
2021-03-12  4:05 ` Xie He

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.