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]
Date:	Thu, 26 May 2016 18:35:55 -0700
From:	Joe Perches <joe@...ches.com>
To:	Long Li <longli@...rosoft.com>,
	"James E.J. Bottomley" <jejb@...ux.vnet.ibm.com>,
	"Martin K. Petersen" <martin.petersen@...cle.com>
Cc:	KY Srinivasan <kys@...rosoft.com>, linux-scsi@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Use the correct size to set block max sectors

dOn Thu, 2016-05-26 at 17:08 -0700, Long Li wrote:
> The block sector size should be in unit of 512 bytes, not in bytes.

Thanks.  The patch subject should use something like:

[PATCH] sd: Use the correct size to set block max sectors

to show what subsystem is being modified.

> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
[]
> @@ -2862,9 +2862,11 @@ static int sd_revalidate_disk(struct gendisk *disk)
>  	if (sdkp->opt_xfer_blocks &&
>  	    sdkp->opt_xfer_blocks <= dev_max &&
>  	    sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS &&
> -	    sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_SIZE)
> -		rw_max = q->limits.io_opt =
> +	    sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_SIZE) {
> +		q->limits.io_opt =
>  			sdkp->opt_xfer_blocks * sdp->sector_size;
> +		rw_max = (q->limits.io_opt >> 9);
> +	}
>  	else
>  		rw_max = BLK_DEF_MAX_SECTORS;

And style trivia:  it'd be more kernel style consistent as:

	if (...
	    sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_SIZE) {
		q->limits.io_opt = sdkp->opt_xfer_blocks * sdp->sector_size;
		rw_max = q->limits.io_opt >> 9;
	} else {
		rw_max = BLK_DEF_MAX_SECTORS;
	}

ie: no parentheses necessary around the shifted value and
    braces around both arms.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ