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: <43ff6de8-a4f0-4606-bfa1-15fb1be2310a@kernel.org>
Date: Fri, 9 Aug 2024 08:22:57 -0700
From: Damien Le Moal <dlemoal@...nel.org>
To: Wouter Verhelst <w@...r.be>, Josef Bacik <josef@...icpanda.com>,
 Jens Axboe <axboe@...nel.dk>
Cc: linux-block@...r.kernel.org, nbd@...er.debian.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 3/3] nbd: correct the maximum value for discard sectors

On 2024/08/08 0:06, Wouter Verhelst wrote:
> The version of the NBD protocol implemented by the kernel driver
> currently has a 32 bit field for length values. As the NBD protocol uses
> bytes as a unit of length, length values larger than 2^32 bytes cannot
> be expressed.
> 
> Update the max_hw_discard_sectors field to match that.
> 
> Signed-off-by: Wouter Verhelst <w@...r.be>
> Fixes: 268283244c0f018dec8bf4a9c69ce50684561f46
> Cc: Damien Le Moal <dlemoal@...nel.org>
> ---
>  drivers/block/nbd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> index fdcf0bbedf3b..235ab5f59608 100644
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -339,7 +339,7 @@ static int __nbd_set_size(struct nbd_device *nbd, loff_t bytesize,
>  
>  	lim = queue_limits_start_update(nbd->disk->queue);
>  	if (nbd->config->flags & NBD_FLAG_SEND_TRIM)
> -		lim.max_hw_discard_sectors = UINT_MAX;
> +		lim.max_hw_discard_sectors = UINT_MAX >> SECTOR_SHIFT;
>  	else
>  		lim.max_hw_discard_sectors = 0;
>  	if (!(nbd->config->flags & NBD_FLAG_SEND_FLUSH)) {

Looks good to me.

Reviewed-by: Damien Le Moal <dlemoal@...nel.org>

-- 
Damien Le Moal
Western Digital Research


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ