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]
Message-ID: <631454442da243998455d325c224f2be@AcuMS.aculab.com>
Date: Mon, 25 Dec 2023 09:57:07 +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 3/4] bpf: Use the sockptr_t helpers

bpfptr_t is defined as sockptr_t but the bpfptr_is_kernel(),
bpfptr_is_null(), KERNEL_BPFPTR() and USER_BPFPTR() helpers are
copies of the sockptr ones.
Instead implement in terms of the sockptr helpers.

Signed-off-by: David Laight <david.laight@...lab.com>
---
 include/linux/bpfptr.h | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/include/linux/bpfptr.h b/include/linux/bpfptr.h
index 79b2f78eec1a..862e87350477 100644
--- a/include/linux/bpfptr.h
+++ b/include/linux/bpfptr.h
@@ -10,17 +10,17 @@ typedef sockptr_t bpfptr_t;
 
 static inline bool bpfptr_is_kernel(bpfptr_t bpfptr)
 {
-	return bpfptr.is_kernel;
+	return sockptr_is_kernel(bpfptr);
 }
 
 static inline bpfptr_t KERNEL_BPFPTR(void *p)
 {
-	return (bpfptr_t) { .kernel = p, .is_kernel = true };
+	return KERNEL_SOCKPTR(p);
 }
 
 static inline bpfptr_t USER_BPFPTR(void __user *p)
 {
-	return (bpfptr_t) { .user = p };
+	return USER_SOCKPTR(p);
 }
 
 static inline bpfptr_t make_bpfptr(u64 addr, bool is_kernel)
@@ -33,9 +33,7 @@ static inline bpfptr_t make_bpfptr(u64 addr, bool is_kernel)
 
 static inline bool bpfptr_is_null(bpfptr_t bpfptr)
 {
-	if (bpfptr_is_kernel(bpfptr))
-		return !bpfptr.kernel;
-	return !bpfptr.user;
+	return sockptr_is_null(bpfptr);
 }
 
 static inline void bpfptr_add(bpfptr_t *bpfptr, size_t val)
-- 
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