summaryrefslogtreecommitdiff
path: root/block/blk.h
diff options
context:
space:
mode:
authorMing Lei <ming.lei@redhat.com>2025-01-15 17:26:48 +0800
committerJens Axboe <axboe@kernel.dk>2025-01-15 15:46:56 -0700
commit3d9a9e9a77c5ebecda43b514f2b9659644b904d0 (patch)
treef880b619f7a0c2430b18829224f309a1103a348a /block/blk.h
parent5d1f7ee7f0b6362c9148d500aeebe49b64b64df4 (diff)
downloadlinux-3d9a9e9a77c5ebecda43b514f2b9659644b904d0.tar.gz
linux-3d9a9e9a77c5ebecda43b514f2b9659644b904d0.tar.bz2
linux-3d9a9e9a77c5ebecda43b514f2b9659644b904d0.zip
block: limit disk max sectors to (LLONG_MAX >> 9)
Kernel `loff_t` is defined as `long long int`, so we can't support disk which size is > LLONG_MAX. There are many virtual block drivers, and hardware may report bad capacity too, so limit max sectors to (LLONG_MAX >> 9) for avoiding potential trouble. Signed-off-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20250115092648.1104452-1-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk.h')
-rw-r--r--block/blk.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/block/blk.h b/block/blk.h
index 4904b86d5fec..90fa5f28ccab 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -13,6 +13,8 @@
struct elevator_type;
+#define BLK_DEV_MAX_SECTORS (LLONG_MAX >> 9)
+
/* Max future timer expiry for timeouts */
#define BLK_MAX_TIMEOUT (5 * HZ)