]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: scsi_debug: Disallow zone sizes that are not powers of 2
authorDamien Le Moal <damien.lemoal@wdc.com>
Thu, 7 May 2020 02:35:26 +0000 (11:35 +0900)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 8 May 2020 00:45:02 +0000 (20:45 -0400)
commita6b91b6da85d09050ac7fbc199fc45a7142e6dbd
tree6791e13e7771e7189956788ea3819c4650238ca3
parent40512dec8bb37c8a1057a4f65a0627a9e06ea7ab
scsi: scsi_debug: Disallow zone sizes that are not powers of 2

Allowing a non-power-of-2 zone size forces the use of direct division
operations of 64-bit sector values to obtain a zone number or number of
zones. Doing so without using do_div() leads to compilation errors on
32-bit architectures.

Devices with a zone size that is not a power of 2 do not exist today so
allowing their emulation is of limited interest as the sd driver will not
support them anyway. To fix this compilation error, instead of using
do_div() for sector values divisions, simply disallow zone size values that
are not a power of 2.

[mkp: commit desc]

Link: https://lore.kernel.org/r/20200507023526.221574-1-damien.lemoal@wdc.com
Fixes: e46bee7fb37c ("scsi: scsi_debug: Add zone_size_mb module parameter")
Fixes: 6a87ea528821 ("scsi: scsi_debug: Add ZBC zone commands")
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_debug.c