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:
Родитель
1b2ff19e6a
Коммит
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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче