Skip to contentSkip to conversation

btrfs: make 1-bit bit-fields unsigned int

PATCH In review Colin Ian King 4 participants 4 messages Nov 10, 2021 – Nov 11, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: make 1-bit bit-fields unsigned int

The bitfields have_csum and io_error are currently signed which is not recommended as the representation is an implementation defined behaviour. Fix this by making the bit-fields unsigned ints.

Fixes 2c36395430b0 ("btrfs: scrub: remove the anonymous structure from scrub_page")
---
 fs/btrfs/scrub.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/scrub.c +2 -2
index cf82ea6f54fb..8f6ceea33969 100644
@@ -73,8 +73,8 @@ struct scrub_page {
 	u64			physical_for_dev_replace;
 	atomic_t		refs;
 	u8			mirror_num;
-	int			have_csum:1;
-	int			io_error:1;
+	unsigned int		have_csum:1;
+	unsigned int		io_error:1;
 	u8			csum[BTRFS_CSUM_SIZE];
 
 	struct scrub_recover	*recover;
Signature · 1 line
2.32.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Colin Ian King

The bitfields have_csum and io_error are currently signed which is not recommended as the representation is an implementation defined behaviour. Fix this by making the bit-fields unsigned ints.

Fixes 2c36395430b0 ("btrfs: scrub: remove the anonymous structure from scrub_page")

Thanks,

Josef

Reviewed-by on v1 1/1
#2 lore raw
In reply to Colin Ian King
Quoted 6 lines · Colin Ian King

The bitfields have_csum and io_error are currently signed which is not recommended as the representation is an implementation defined behaviour. Fix this by making the bit-fields unsigned ints.

Fixes 2c36395430b0 ("btrfs: scrub: remove the anonymous structure from scrub_page")

Thanks,
Qu

Quoted 20 lines
---
  fs/btrfs/scrub.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/scrub.c +2 -2
index cf82ea6f54fb..8f6ceea33969 100644
@@ -73,8 +73,8 @@ struct scrub_page {
  	u64			physical_for_dev_replace;
  	atomic_t		refs;
  	u8			mirror_num;
-	int			have_csum:1;
-	int			io_error:1;
+	unsigned int		have_csum:1;
+	unsigned int		io_error:1;
  	u8			csum[BTRFS_CSUM_SIZE];
 
  	struct scrub_recover	*recover;
#3 lore raw
In reply to Colin Ian King
Quoted 6 lines · Colin Ian King

The bitfields have_csum and io_error are currently signed which is not recommended as the representation is an implementation defined behaviour. Fix this by making the bit-fields unsigned ints.

Fixes 2c36395430b0 ("btrfs: scrub: remove the anonymous structure from scrub_page")

Added to misc-next, thanks.