mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-05-02 18:15:03 -04:00
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>
This commit is contained in:
@@ -155,7 +155,7 @@ static struct btrfs_ordered_extent *alloc_ordered_extent(
|
||||
u64 qgroup_rsv = 0;
|
||||
|
||||
if (flags &
|
||||
((1 << BTRFS_ORDERED_NOCOW) | (1 << BTRFS_ORDERED_PREALLOC))) {
|
||||
((1U << BTRFS_ORDERED_NOCOW) | (1U << BTRFS_ORDERED_PREALLOC))) {
|
||||
/* For nocow write, we can release the qgroup rsv right now */
|
||||
ret = btrfs_qgroup_free_data(inode, NULL, file_offset, num_bytes, &qgroup_rsv);
|
||||
if (ret < 0)
|
||||
@@ -253,7 +253,7 @@ static void insert_ordered_extent(struct btrfs_ordered_extent *entry)
|
||||
* @disk_bytenr: Offset of extent on disk.
|
||||
* @disk_num_bytes: Size of extent on disk.
|
||||
* @offset: Offset into unencoded data where file data starts.
|
||||
* @flags: Flags specifying type of extent (1 << BTRFS_ORDERED_*).
|
||||
* @flags: Flags specifying type of extent (1U << BTRFS_ORDERED_*).
|
||||
* @compress_type: Compression algorithm used for data.
|
||||
*
|
||||
* Most of these parameters correspond to &struct btrfs_file_extent_item. The
|
||||
|
||||
Reference in New Issue
Block a user