diff options
author | David Sterba <dsterba@suse.com> | 2025-04-22 17:55:41 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2025-05-15 14:30:48 +0200 |
commit | 05a6ec865d091fe8244657df8063f74e704d1711 (patch) | |
tree | 4522b724dbec7392ae63f10db8f2eb89dc156b7d /fs/btrfs/raid56.c | |
parent | d4d788a776b49c1e8961104caa2b715bc49074af (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/raid56.c')
-rw-r--r-- | fs/btrfs/raid56.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index 99488a5407d6..bb9ae0e281d9 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c @@ -203,8 +203,7 @@ int btrfs_alloc_stripe_hash_table(struct btrfs_fs_info *info) struct btrfs_stripe_hash_table *x; struct btrfs_stripe_hash *cur; struct btrfs_stripe_hash *h; - int num_entries = 1 << BTRFS_STRIPE_HASH_TABLE_BITS; - int i; + unsigned int num_entries = 1U << BTRFS_STRIPE_HASH_TABLE_BITS; if (info->stripe_hash_table) return 0; @@ -225,7 +224,7 @@ int btrfs_alloc_stripe_hash_table(struct btrfs_fs_info *info) h = table->table; - for (i = 0; i < num_entries; i++) { + for (unsigned int i = 0; i < num_entries; i++) { cur = h + i; INIT_LIST_HEAD(&cur->hash_list); spin_lock_init(&cur->lock); |