Re: [PATCH v2] btrfs: zoned: fix zone number to sector/physical calculation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 27, 2021 at 03:27:32PM +0900, Naohiro Aota wrote:
> In btrfs_get_dev_zone_info(), we have "u32 sb_zone" and calculate "sector_t
> sector" by shifting it. But, this "sector" is calculated in 32bit, leading
> it to be 0 for the 2nd superblock copy.
> 
> Since zone number is u32, shifting it to sector (sector_t) or physical
> address (u64) can easily trigger a missing cast bug like this.
> 
> This commit introduces helpers to convert zone number to sector/LBA, so we
> won't fall into the same pitfall again.
> 
> Fixes: 12659251ca5d ("btrfs: implement log-structured superblock for ZONED mode")
> Cc: stable@xxxxxxxxxxxxxxx # 5.11+
> Reported-by: Dmitry Fomichev <Dmitry.Fomichev@xxxxxxx>
> Signed-off-by: Naohiro Aota <naohiro.aota@xxxxxxx>

Added to misc-next, thanks.



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux