]> Git Repo - J-linux.git/commitdiff
nvme: use blk_validate_block_size() for max LBA check
authorLuis Chamberlain <[email protected]>
Wed, 18 Dec 2024 02:02:12 +0000 (18:02 -0800)
committerJens Axboe <[email protected]>
Wed, 18 Dec 2024 14:22:30 +0000 (07:22 -0700)
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 <[email protected]>
Reviewed-by: John Garry <[email protected]>
Reviewed-by: Keith Busch <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
drivers/nvme/host/core.c

index d169a30eb935e034bfbb78d1a31751dbedf0e397..a970168a3014e665006ed5576017bd764652eaa8 100644 (file)
@@ -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;
        }
This page took 0.052293 seconds and 4 git commands to generate.