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]
Date: Mon, 25 Dec 2023 09:51:30 +0000
From: David Laight <David.Laight@...LAB.COM>
To: "'netdev@...r.kernel.org'" <netdev@...r.kernel.org>, "'David S . Miller'"
	<davem@...emloft.net>, "'kuba@...nel.org'" <kuba@...nel.org>
CC: "'eric.dumazet@...il.com'" <eric.dumazet@...il.com>,
	"'martin.lau@...ux.dev'" <martin.lau@...ux.dev>, 'Alexei Starovoitov'
	<ast@...nel.org>, 'Stephen Hemminger' <stephen@...workplumber.org>, "'Jens
 Axboe'" <axboe@...nel.dk>, 'Daniel Borkmann' <daniel@...earbox.net>, "'Andrii
 Nakryiko'" <andrii@...nel.org>
Subject: [PATCH net-next 1/4] net: Use sockptr_is_kernel() instead of testing
 is_kernel

Some changes to option handling directly accesses optval.is_kernel.
Use the sockptr_is_kernel() helper instead.

No functional change.

Signed-off-by: David Laight <david.laight@...lab.com>
---
 net/ipv4/ip_sockglue.c   | 2 +-
 net/ipv6/ipv6_sockglue.c | 2 +-
 net/socket.c             | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 2efc53526a38..94b2f8c095f5 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -1647,7 +1647,7 @@ int do_ip_getsockopt(struct sock *sk, int level, int optname,
 		if (sk->sk_type != SOCK_STREAM)
 			return -ENOPROTOOPT;
 
-		if (optval.is_kernel) {
+		if (sockptr_is_kernel(optval)) {
 			msg.msg_control_is_user = false;
 			msg.msg_control = optval.kernel;
 		} else {
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 7d661735cb9d..64fc52d928c1 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -1144,7 +1144,7 @@ int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
 		if (sk->sk_type != SOCK_STREAM)
 			return -ENOPROTOOPT;
 
-		if (optval.is_kernel) {
+		if (sockptr_is_kernel(optval)) {
 			msg.msg_control_is_user = false;
 			msg.msg_control = optval.kernel;
 		} else {
diff --git a/net/socket.c b/net/socket.c
index 3379c64217a4..8821f083ab0a 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2366,7 +2366,7 @@ int do_sock_getsockopt(struct socket *sock, bool compat, int level,
 	} else if (unlikely(!ops->getsockopt)) {
 		err = -EOPNOTSUPP;
 	} else {
-		if (WARN_ONCE(optval.is_kernel || optlen.is_kernel,
+		if (WARN_ONCE(sockptr_is_kernel(optval) || sockptr_is_kernel(optlen),
 			      "Invalid argument type"))
 			return -EOPNOTSUPP;
 
-- 
2.17.1

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ