From 76c49eb686771c7af5a0e6a973bd0d3360a8774f Mon Sep 17 00:00:00 2001 From: David Sterba Date: Tue, 12 Mar 2024 22:03:36 +0100 Subject: [PATCH] btrfs-progs: use unsigned types for bit shifts in configure.ac and docs Bit shifts should be done on unsigned type as a matter of good practice to avoid any problems with bit overflowing to the sign bit. Signed-off-by: David Sterba --- Documentation/btrfs-ioctl.rst | 6 +++--- configure.ac | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/btrfs-ioctl.rst b/Documentation/btrfs-ioctl.rst index fc7ebd15..32263c09 100644 --- a/Documentation/btrfs-ioctl.rst +++ b/Documentation/btrfs-ioctl.rst @@ -155,11 +155,11 @@ DATA STRUCTURES AND DEFINITIONS .. code-block:: c /* Request information about checksum type and size */ - #define BTRFS_FS_INFO_FLAG_CSUM_INFO (1 << 0) + #define BTRFS_FS_INFO_FLAG_CSUM_INFO (1U << 0) /* Request information about filesystem generation */ - #define BTRFS_FS_INFO_FLAG_GENERATION (1 << 1) + #define BTRFS_FS_INFO_FLAG_GENERATION (1U << 1) /* Request information about filesystem metadata UUID */ - #define BTRFS_FS_INFO_FLAG_METADATA_UUID (1 << 2) + #define BTRFS_FS_INFO_FLAG_METADATA_UUID (1U << 2) struct btrfs_ioctl_fs_info_args { __u64 max_id; /* out */ diff --git a/configure.ac b/configure.ac index f550c9d2..007d29b3 100644 --- a/configure.ac +++ b/configure.ac @@ -310,7 +310,7 @@ AS_IF([test "x$have_ext4_epoch_mask_define" = xno], [ [ AC_DEFINE([HAVE_EXT4_EPOCH_MASK_DEFINE], [1], [Define to 1 if ext2_inode_large includes i_atime_extra]) AC_DEFINE([EXT4_EPOCH_BITS], [2],[for encode and decode tv_nsec in ext2 inode]) - AC_DEFINE([EXT4_EPOCH_MASK], [((1 << EXT4_EPOCH_BITS) - 1)], [For encode and decode tv_nsec info in ext2 inode]) + AC_DEFINE([EXT4_EPOCH_MASK], [((1U << EXT4_EPOCH_BITS) - 1)], [For encode and decode tv_nsec info in ext2 inode]) AC_DEFINE([EXT4_NSEC_MASK], [(~0UL << EXT4_EPOCH_BITS)], [For encode and decode tv_nsec info in ext2 inode]) AC_DEFINE([inode_includes(size, field)],[m4_normalize[(size >= (sizeof(((struct ext2_inode_large *)0)->field) + offsetof(struct ext2_inode_large, field)))]], [For encode and decode tv_nsec info in ext2 inode])