Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6824c5ef authored by Keith Busch's avatar Keith Busch Committed by Jens Axboe
Browse files

NVMe: Fix possible arithmetic overflow for max segments

parent 1b2ff19e
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -2268,7 +2268,7 @@ static void nvme_alloc_ns(struct nvme_dev *dev, unsigned nsid)
	if (dev->max_hw_sectors) {
	if (dev->max_hw_sectors) {
		blk_queue_max_hw_sectors(ns->queue, dev->max_hw_sectors);
		blk_queue_max_hw_sectors(ns->queue, dev->max_hw_sectors);
		blk_queue_max_segments(ns->queue,
		blk_queue_max_segments(ns->queue,
			((dev->max_hw_sectors << 9) / dev->page_size) + 1);
			(dev->max_hw_sectors / (dev->page_size >> 9)) + 1);
	}
	}
	if (dev->stripe_size)
	if (dev->stripe_size)
		blk_queue_chunk_sectors(ns->queue, dev->stripe_size >> 9);
		blk_queue_chunk_sectors(ns->queue, dev->stripe_size >> 9);