lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <yq1ttfpw5zs.fsf@ca-mkp.ca.oracle.com>
Date: Mon, 12 Aug 2024 21:52:52 -0400
From: "Martin K. Petersen" <martin.petersen@...cle.com>
To: Chaotian Jing <chaotian.jing@...iatek.com>
Cc: <James.Bottomley@...senPartnership.com>, <martin.petersen@...cle.com>,
        Matthias Brugger <matthias.bgg@...il.com>,
        AngeloGioacchino Del Regno
 <angelogioacchino.delregno@...labora.com>,
        <linux-scsi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-mediatek@...ts.infradead.org>, <srv_heupstream@...iatek.com>,
        <stable@...r.kernel.org>, Bart Van Assche <bvanassche@....org>
Subject: Re: [PATCH] scsi: fix the return value of scsi_logical_block_count


Chaotian,

> @@ -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;
>  }

There's no point in shifting twice by converting to sectors first.
Please just remove the SECTOR_SHIFT subtraction.

-- 
Martin K. Petersen	Oracle Linux Engineering

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ