]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: sd: sd_zbc: Verify that the zone size is a power of two
authorBart Van Assche <bvanassche@acm.org>
Thu, 21 Apr 2022 18:30:16 +0000 (11:30 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 26 Apr 2022 03:23:04 +0000 (23:23 -0400)
commit39f46dc7535a66f9c30abd28327ebc5cfa43e268
tree50462096621bf891cdf3dc6136696ed1172de8c0
parent7ce5146113d07e6220e7bd7b220c5f83f99a20e3
scsi: sd: sd_zbc: Verify that the zone size is a power of two

The following check in sd_zbc_cmnd_checks() can only work correctly if the
zone size is a power of two:

if (sector & (sd_zbc_zone_sectors(sdkp) - 1))
/* Unaligned request */
return BLK_STS_IOERR;

Hence this patch that verifies that the zone size is a power of two.

Link: https://lore.kernel.org/r/20220421183023.3462291-3-bvanassche@acm.org
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sd_zbc.c