Message ID | 81030329cd7526ec374fa4e76ac6bc4b0ed56e25.1671221596.git.josef@toxicpanda.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Fixup uninitialized warnings and enable extra checks | expand |
On Fri, Dec 16, 2022 at 03:15:57PM -0500, Josef Bacik wrote: > We only have 3 possible mirrors, and we have ASSERT()'s to make sure > we're not passing in an invalid super mirror into this function, so > technically this value isn't uninitialized. However > -Wmaybe-uninitialized will complain, so set it to U64_MAX so if we don't > have ASSERT()'s turned on it'll error out later on when it see's the > zone is beyond our maximum zones. > > Signed-off-by: Josef Bacik <josef@toxicpanda.com> Looks good. Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index f3640ab95e5e..54568735415d 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -160,7 +160,7 @@ static int sb_write_pointer(struct block_device *bdev, struct blk_zone *zones, */ static inline u32 sb_zone_number(int shift, int mirror) { - u64 zone; + u64 zone = U64_MAX; ASSERT(mirror < BTRFS_SUPER_MIRROR_MAX); switch (mirror) {
We only have 3 possible mirrors, and we have ASSERT()'s to make sure we're not passing in an invalid super mirror into this function, so technically this value isn't uninitialized. However -Wmaybe-uninitialized will complain, so set it to U64_MAX so if we don't have ASSERT()'s turned on it'll error out later on when it see's the zone is beyond our maximum zones. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- fs/btrfs/zoned.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)