summaryrefslogtreecommitdiffstats
path: root/drivers/nvme
diff options
context:
space:
mode:
authorLuis Chamberlain <mcgrof@kernel.org>2024-12-18 03:02:12 +0100
committerJens Axboe <axboe@kernel.dk>2024-12-18 15:22:30 +0100
commit51588b1b77b65cd0fb3440f78f37bef7178a2715 (patch)
tree0823a5d0981bedd32da3c95a21f845e14d4c6b06 /drivers/nvme
parentblock/bdev: use helper for max block size check (diff)
downloadlinux-51588b1b77b65cd0fb3440f78f37bef7178a2715.tar.xz
linux-51588b1b77b65cd0fb3440f78f37bef7178a2715.zip
nvme: use blk_validate_block_size() for max LBA check
The block layer already has support to validates proper block sizes with blk_validate_block_size(), we can leverage that as well. No functional changes. Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> Reviewed-by: John Garry <john.g.garry@oracle.com> Reviewed-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20241218020212.3657139-3-mcgrof@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/nvme')
-rw-r--r--drivers/nvme/host/core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index d169a30eb935..a970168a3014 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2034,7 +2034,7 @@ static bool nvme_update_disk_info(struct nvme_ns *ns, struct nvme_id_ns *id,
* or smaller than a sector size yet, so catch this early and don't
* allow block I/O.
*/
- if (head->lba_shift > PAGE_SHIFT || head->lba_shift < SECTOR_SHIFT) {
+ if (blk_validate_block_size(bs)) {
bs = (1 << 9);
valid = false;
}