Skip to content

Commit 51588b1

Browse files
mcgrofaxboe
authored andcommitted
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 <[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]>
1 parent 26fff8a commit 51588b1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/nvme/host/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2034,7 +2034,7 @@ static bool nvme_update_disk_info(struct nvme_ns *ns, struct nvme_id_ns *id,
20342034
* or smaller than a sector size yet, so catch this early and don't
20352035
* allow block I/O.
20362036
*/
2037-
if (head->lba_shift > PAGE_SHIFT || head->lba_shift < SECTOR_SHIFT) {
2037+
if (blk_validate_block_size(bs)) {
20382038
bs = (1 << 9);
20392039
valid = false;
20402040
}

0 commit comments

Comments
 (0)