diff options
author | Keith Busch <keith.busch@intel.com> | 2015-11-18 16:33:08 -0700 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-11-19 13:02:24 -0700 |
commit | 6824c5ef5e8900e61ce8ed40885cacc1c9301c14 (patch) | |
tree | 8519552bac5caa992fbba12f5cde82aa13512c82 /drivers/nvme | |
parent | 1b2ff19e6a957b1ef0f365ad331b608af80e932e (diff) |
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>
Diffstat (limited to 'drivers/nvme')
-rw-r--r-- | drivers/nvme/host/pci.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 8187df204695..394fd1631cd0 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -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); |