summaryrefslogtreecommitdiff
path: root/lib/ext2fs/bitops.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2023-01-21 12:32:07 -0800
committerTheodore Ts'o <tytso@mit.edu>2023-01-27 12:33:59 -0500
commit71c2baa11755344730e67f6b0faa5a6b30764f5a (patch)
tree5d346c0f96d6e366f8fc393a84819248c213ab45 /lib/ext2fs/bitops.c
parent6a5d03d4a5cd1fae84c94c797f28e86fae831865 (diff)
downloade2fsprogs-71c2baa11755344730e67f6b0faa5a6b30764f5a.tar.gz
lib/ext2fs: remove 32-bit x86 bitops assembly
The EXT2FS_ADDR() macro is causing -Warray-bounds warnings because it (sort of) dereferences past the end of the input array. It's not a "real" dereference, since the result is passed as a memory operand to inline asm. But in the C language sense, it is a dereference. Instead of trying to fix this code, let's consider that libext2fs *only* implements the bit operations in assembly for 32-bit x86, which is rarely used anymore. The fact that compilers have also improved, and no one has implemented these for another architecture, even x86_64, suggests it's not useful either. So, let's just remove this outdated code, which was maybe useful in the 90s, but now just causes problems. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'lib/ext2fs/bitops.c')
-rw-r--r--lib/ext2fs/bitops.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/lib/ext2fs/bitops.c b/lib/ext2fs/bitops.c
index c4a1d4e0..ce2acc46 100644
--- a/lib/ext2fs/bitops.c
+++ b/lib/ext2fs/bitops.c
@@ -19,14 +19,8 @@
#include "ext2_fs.h"
#include "ext2fs.h"
-#ifndef _EXT2_HAVE_ASM_BITOPS_
-
/*
- * For the benefit of those who are trying to port Linux to another
- * architecture, here are some C-language equivalents. You should
- * recode these in the native assembly language, if at all possible.
- *
- * C language equivalents written by Theodore Ts'o, 9/26/92.
+ * C language bitmap functions written by Theodore Ts'o, 9/26/92.
* Modified by Pete A. Zaitcev 7/14/95 to be portable to big endian
* systems, as well as non-32 bit systems.
*/
@@ -65,8 +59,6 @@ int ext2fs_test_bit(unsigned int nr, const void * addr)
return (mask & *ADDR);
}
-#endif /* !_EXT2_HAVE_ASM_BITOPS_ */
-
void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg,
const char *description)
{
@@ -78,9 +70,7 @@ void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg,
#endif
}
-/*
- * C-only 64 bit ops.
- */
+/* Bitmap functions that take a 64-bit offset */
int ext2fs_set_bit64(__u64 nr, void * addr)
{