NVMe: Fix possible arithmetic overflow for max segments
PATCH 1/1 NVMe: Fix possible arithmetic overflow for max segments
Reported-by Paul Grabinar <paul.grabinar at ranbarg.com>
Signed-off-by Keith Busch <keith.busch at intel.com>
--- drivers/nvme/host/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/pci.c +1 -1
@@ -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 );
Signature · 1 line
2.6.2.307.g37023ba
PATCH 1/1 NVMe: Fix possible arithmetic overflow for max segments
Quoted 2 lines · Keith Busch
Reported-by Paul Grabinar <paul.grabinar at ranbarg.com>Signed-off-by Keith Busch <keith.busch at intel.com>
Applied for 4.4, thanks.
Signature · 1 line
Jens Axboe