mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 04:31:50 +00:00
NVMe: Fix possible arithmetic overflow for max segments
Reported-by: Paul Grabinar <paul.grabinar@ranbarg.com> Signed-off-by: Keith Busch <keith.busch@intel.com> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
1b2ff19e6a
commit
6824c5ef5e
@ -2268,7 +2268,7 @@ static void nvme_alloc_ns(struct nvme_dev *dev, unsigned nsid)
|
||||
if (dev->max_hw_sectors) {
|
||||
blk_queue_max_hw_sectors(ns->queue, dev->max_hw_sectors);
|
||||
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)
|
||||
blk_queue_chunk_sectors(ns->queue, dev->stripe_size >> 9);
|
||||
|
Loading…
Reference in New Issue
Block a user