Re: [PATCH] scsi: fix the return value of scsi_logical_block_count

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

 



On 8/6/24 12:26 AM, Chaotian Jing wrote:
scsi_logical_block_count() should return the block count of scsi device,
but the original code has a wrong implement.

Signed-off-by: Chaotian Jing <chaotian.jing@xxxxxxxxxxxx>
---
  include/scsi/scsi_cmnd.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 45c40d200154..f0be0caa295a 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -236,7 +236,7 @@ static inline unsigned int scsi_logical_block_count(struct scsi_cmnd *scmd)
  {
  	unsigned int shift = ilog2(scmd->device->sector_size) - SECTOR_SHIFT;
- return blk_rq_bytes(scsi_cmd_to_rq(scmd)) >> shift;
+	return blk_rq_sectors(scsi_cmd_to_rq(scmd)) >> shift;
  }
/*

Please add the following to this patch:

Cc: stable@xxxxxxxxxxxxxxx
Fixes: 6a20e21ae1e2 ("scsi: core: Add helper to return number of logical blocks in a request")

Anyway:

Reviewed-by: Bart Van Assche <bvanassche@xxxxxxx>




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux