All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Keith Busch <kbusch@meta.com>,
	linux-block@vger.kernel.org, axboe@kernel.dk
Cc: hch@lst.de, martin.petersen@oracle.com,
	Damien Le Moal <damien.lemoal@opensource.wdc.com>,
	Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCHv4 2/2] block: save user max_sectors limit
Date: Thu, 5 Jan 2023 13:28:35 -0800	[thread overview]
Message-ID: <fff1ca57-b0ee-9598-9ea8-e6c8b7571f0d@acm.org> (raw)
In-Reply-To: <20230105205146.3610282-3-kbusch@meta.com>

On 1/5/23 12:51, Keith Busch wrote:
> diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
> index 93d9e9c9a6ea8..5486b6c57f6b8 100644
> --- a/block/blk-sysfs.c
> +++ b/block/blk-sysfs.c
> @@ -239,19 +239,28 @@ static ssize_t queue_zone_append_max_show(struct request_queue *q, char *page)
>   static ssize_t
>   queue_max_sectors_store(struct request_queue *q, const char *page, size_t count)
>   {
> -	unsigned long max_sectors_kb,
> +	unsigned long var;
> +	unsigned int max_sectors_kb,
>   		max_hw_sectors_kb = queue_max_hw_sectors(q) >> 1,
>   			page_kb = 1 << (PAGE_SHIFT - 10);
> -	ssize_t ret = queue_var_store(&max_sectors_kb, page, count);
> +	ssize_t ret = queue_var_store(&var, page, count);
>   
>   	if (ret < 0)
>   		return ret;
>   
> -	max_hw_sectors_kb = min_not_zero(max_hw_sectors_kb, (unsigned long)
> +	max_sectors_kb = (unsigned int)var;

Shouldn't this function report an error if 'var' is too large to fit 
into an unsigned int?

Otherwise this patch looks good to me.

Thanks,

Bart.

  reply	other threads:[~2023-01-05 21:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-05 20:51 [PATCHv4 0/2] block: don't forget user settings Keith Busch
2023-01-05 20:51 ` [PATCHv4 1/2] block: make BLK_DEF_MAX_SECTORS unsigned Keith Busch
2023-01-05 21:19   ` Bart Van Assche
2023-01-08 17:13   ` Christoph Hellwig
2023-01-09  0:23   ` Martin K. Petersen
2023-01-05 20:51 ` [PATCHv4 2/2] block: save user max_sectors limit Keith Busch
2023-01-05 21:28   ` Bart Van Assche [this message]
2023-01-05 21:36     ` Keith Busch
2023-01-08 17:13   ` Christoph Hellwig
2023-01-09  0:25   ` Martin K. Petersen
2023-01-09  3:27 ` [PATCHv4 0/2] block: don't forget user settings Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fff1ca57-b0ee-9598-9ea8-e6c8b7571f0d@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=kbusch@meta.com \
    --cc=linux-block@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.