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  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:   Wed, 14 Apr 2021 00:41:28 -0700
From:   Michael Forney <mforney@...rney.org>
To:     linux-ext4@...r.kernel.org
Subject: [PATCH 2/2] libext2fs: use offsetof() from stddef.h

offsetof is a standard C feature available from stddef.h, going
back all the way to ANSI C.

Signed-off-by: Michael Forney <mforney@...rney.org>
---
Perhaps there is some reason to prefer compiler builtins over libc
that I'm not seeing?

 lib/ext2fs/compiler.h | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/lib/ext2fs/compiler.h b/lib/ext2fs/compiler.h
index 03c35ab8..42faa61c 100644
--- a/lib/ext2fs/compiler.h
+++ b/lib/ext2fs/compiler.h
@@ -1,18 +1,7 @@
 #ifndef _EXT2FS_COMPILER_H
 #define _EXT2FS_COMPILER_H
 
-#ifndef __has_builtin
-#define __has_builtin(x) 0
-#endif
-
-#undef offsetof
-#if __has_builtin(__builtin_offsetof)
-#define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
-#elif defined(__compiler_offsetof)
-#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
-#else
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
+#include <stddef.h>
 
 #ifdef __GNUC__
 #define container_of(ptr, type, member) ({			\
-- 
2.30.1

Powered by blists - more mailing lists