summaryrefslogtreecommitdiff
path: root/fs/btrfs/extent_io.h
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2025-04-22 17:55:41 +0200
committerDavid Sterba <dsterba@suse.com>2025-05-15 14:30:48 +0200
commit05a6ec865d091fe8244657df8063f74e704d1711 (patch)
tree4522b724dbec7392ae63f10db8f2eb89dc156b7d /fs/btrfs/extent_io.h
parentd4d788a776b49c1e8961104caa2b715bc49074af (diff)
btrfs: use unsigned types for constants defined as bit shifts
The unsigned type is a recommended practice (CWE-190, CWE-194) for bit shifts to avoid problems with potential unwanted sign extensions. Although there are no such cases in btrfs codebase, follow the recommendation. Reviewed-by: Boris Burkov <boris@bur.io> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/extent_io.h')
-rw-r--r--fs/btrfs/extent_io.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index a2a3d4d15ade..e8b92340b65a 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -73,7 +73,7 @@ enum {
* single word in a bitmap may straddle two pages in the extent buffer.
*/
#define BIT_BYTE(nr) ((nr) / BITS_PER_BYTE)
-#define BYTE_MASK ((1 << BITS_PER_BYTE) - 1)
+#define BYTE_MASK ((1U << BITS_PER_BYTE) - 1)
#define BITMAP_FIRST_BYTE_MASK(start) \
((BYTE_MASK << ((start) & (BITS_PER_BYTE - 1))) & BYTE_MASK)
#define BITMAP_LAST_BYTE_MASK(nbits) \