Linux block layer
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Yingjie Wang <x-professor@outlook.com>,
	"axboe@kernel.dk" <axboe@kernel.dk>
Cc: "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH v3 1/4] block: move BLK_DEV_MAX_SECTORS to <linux/blkdev.h>
Date: Mon, 30 Nov 2026 13:50:05 +0900	[thread overview]
Message-ID: <8cbaf087-2b36-4063-938f-604ab36d645e@kernel.org> (raw)
In-Reply-To: <20261127125738.1654012-2-x-professor@outlook.com>

On 11/27/26 21:58, Yingjie Wang wrote:
> BLK_DEV_MAX_SECTORS is the largest disk capacity the block layer
> supports: set_capacity() truncates larger capacities and add_disk()
> rejects them. It is defined in block/blk.h, so drivers cannot use it to
> validate a capacity they get from the user before calling
> set_capacity().
> 
> Move it to <linux/blkdev.h>. The next patch uses it in null_blk to
> reject a configured device size that is too large. No functional change.
> 
> Cc: stable@vger.kernel.org # 6.14.x
> Signed-off-by: Yingjie Wang <x-professor@outlook.com>
> ---
>  block/blk.h            | 1 -
>  include/linux/blkdev.h | 6 ++++++
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/block/blk.h b/block/blk.h
> index 105fff157bfb..13fa24aa05ea 100644
> --- a/block/blk.h
> +++ b/block/blk.h
> @@ -23,7 +23,6 @@ struct elv_change_ctx;
>   */
>  #define BLK_DEF_MAX_SECTORS_CAP	(SZ_4M >> SECTOR_SHIFT)
>  
> -#define	BLK_DEV_MAX_SECTORS	(LLONG_MAX >> 9)

Please use SECTOR_SHIFT instead of 9.

-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2026-11-30  4:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 12:57 [PATCH v3 0/4] null_blk: validate configfs values before power-on Yingjie Wang
2026-11-27 12:58 ` [PATCH v3 1/4] block: move BLK_DEV_MAX_SECTORS to <linux/blkdev.h> Yingjie Wang
2026-11-30  4:50   ` Damien Le Moal [this message]
2026-11-27 12:58 ` [PATCH v3 2/4] null_blk: reject device size overflow Yingjie Wang
2026-11-30  4:52   ` Damien Le Moal
2026-11-27 12:58 ` [PATCH v3 3/4] null_blk: reject zone counts that overflow unsigned int Yingjie Wang
2026-11-30  4:54   ` Damien Le Moal
2026-11-27 12:59 ` [PATCH v3 4/4] null_blk: validate the configfs home_node attribute Yingjie Wang
2026-11-30  4:54   ` Damien Le Moal

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=8cbaf087-2b36-4063-938f-604ab36d645e@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=x-professor@outlook.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox