blob: 74b56f7ef29f0ce12cee2204d0d0019ac52d263b [file] [log] [blame]
From a63f911cb27679df2e97e5582140cd08acb1f783 Mon Sep 17 00:00:00 2001
From: Keith Busch <kbusch@kernel.org>
Date: Sat, 7 Dec 2019 01:51:54 +0900
Subject: [PATCH] nvme/pci: Fix write and poll queue types
commit 3f68baf706ec68c4120867c25bc439c845fe3e17 upstream.
The number of poll or write queues should never be negative. Use unsigned
types so that it's not possible to break have the driver not allocate
any queues.
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Keith Busch <kbusch@kernel.org>
[PG: module_param_cb in v5.2 doesn't have a type arg.]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index c9f5983a9f82..c8b27b6569e4 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -73,13 +73,13 @@ static const struct kernel_param_ops queue_count_ops = {
.get = param_get_int,
};
-static int write_queues;
+static unsigned int write_queues;
module_param_cb(write_queues, &queue_count_ops, &write_queues, 0644);
MODULE_PARM_DESC(write_queues,
"Number of queues to use for writes. If not set, reads and writes "
"will share a queue set.");
-static int poll_queues = 0;
+static unsigned int poll_queues = 0;
module_param_cb(poll_queues, &queue_count_ops, &poll_queues, 0644);
MODULE_PARM_DESC(poll_queues, "Number of queues to use for polled IO.");
--
2.7.4