]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
scsi: core: Fix the return value of scsi_logical_block_count()
authorChaotian Jing <chaotian.jing@mediatek.com>
Tue, 13 Aug 2024 05:34:10 +0000 (13:34 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Aug 2024 15:36:06 +0000 (17:36 +0200)
commit75abfcf641d8efc485e753231356d14cdcb4918c
tree76e91dc0b4b9e01374609ae34b66a9c73e48e0ce
parentee0799103b1ae4bcfd80dc11a15df085f6ee1b61
scsi: core: Fix the return value of scsi_logical_block_count()

commit f03e94f23b04c2b71c0044c1534921b3975ef10c upstream.

scsi_logical_block_count() should return the block count of a given SCSI
command. The original implementation ended up shifting twice, leading to an
incorrect count being returned. Fix the conversion between bytes and
logical blocks.

Cc: stable@vger.kernel.org
Fixes: 6a20e21ae1e2 ("scsi: core: Add helper to return number of logical blocks in a request")
Signed-off-by: Chaotian Jing <chaotian.jing@mediatek.com>
Link: https://lore.kernel.org/r/20240813053534.7720-1-chaotian.jing@mediatek.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/scsi/scsi_cmnd.h