* [PATCH] NVMe: Fix possible arithmetic overflow for max segments
@ 2015-11-18 23:33 Keith Busch
2015-11-19 20:03 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Keith Busch @ 2015-11-18 23:33 UTC (permalink / raw)
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(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 8187df2..394fd16 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);
--
2.6.2.307.g37023ba
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] NVMe: Fix possible arithmetic overflow for max segments
2015-11-18 23:33 [PATCH] NVMe: Fix possible arithmetic overflow for max segments Keith Busch
@ 2015-11-19 20:03 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2015-11-19 20:03 UTC (permalink / raw)
On 11/18/2015 04:33 PM, Keith Busch wrote:
> Reported-by: Paul Grabinar <paul.grabinar at ranbarg.com>
> Signed-off-by: Keith Busch <keith.busch at intel.com>
Applied for 4.4, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-11-19 20:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-18 23:33 [PATCH] NVMe: Fix possible arithmetic overflow for max segments Keith Busch
2015-11-19 20:03 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).