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:   Fri, 19 Nov 2021 12:36:37 +0100
From:   Alejandro Colomar <alx.manpages@...il.com>
To:     LKML <linux-kernel@...r.kernel.org>
Cc:     Alejandro Colomar <alx.manpages@...il.com>
Subject: [PATCH 09/17] linux/offsetof.h: Implement offsetof() in terms of memberof()

Use memberof() instead of explicitly dereferencing a null pointer.

Signed-off-by: Alejandro Colomar <alx.manpages@...il.com>
---
 include/linux/offsetof.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/offsetof.h b/include/linux/offsetof.h
index d0e2f1c34aae..809aed37ad29 100644
--- a/include/linux/offsetof.h
+++ b/include/linux/offsetof.h
@@ -3,13 +3,14 @@
 #define _LINUX_OFFSETOF_H
 
 #include <linux/compiler_types.h>
+#include <linux/memberof.h>
 
 
 #undef offsetof
 #ifdef __compiler_offsetof
 #define offsetof(TYPE, MEMBER)	__compiler_offsetof(TYPE, MEMBER)
 #else
-#define offsetof(TYPE, MEMBER)	((size_t)&((TYPE *)0)->MEMBER)
+#define offsetof(TYPE, MEMBER)	((size_t)&memberof(TYPE, MEMBER))
 #endif
 
 
-- 
2.33.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ