summaryrefslogtreecommitdiffstats
path: root/drivers/nvme
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-07-06 11:26:52 +0200
committerSagi Grimberg <sagi@grimberg.me>2017-07-10 08:09:58 +0200
commit2ee0e4ed5ca24c0642a7b72d75b4fe6dfc0a8db8 (patch)
tree6b04e8d1d7ea90fb04bc2ac69488faa9ad3edcbf /drivers/nvme
parentnvmet_fc: Accept variable pad lengths on Create Association LS (diff)
downloadlinux-2ee0e4ed5ca24c0642a7b72d75b4fe6dfc0a8db8.tar.xz
linux-2ee0e4ed5ca24c0642a7b72d75b4fe6dfc0a8db8.zip
nvme-pci: compile warnings in nvme_alloc_host_mem()
"i" should be signed or it could cause a forever loop on the cleanup path. "size" can be used uninitialized. Fixes: 87ad72a59a38 ("nvme-pci: implement host memory buffer support") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Diffstat (limited to 'drivers/nvme')
-rw-r--r--drivers/nvme/host/pci.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 882ed3677117..73fddf2c99f9 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1582,9 +1582,10 @@ static void nvme_free_host_mem(struct nvme_dev *dev)
static int nvme_alloc_host_mem(struct nvme_dev *dev, u64 min, u64 preferred)
{
struct nvme_host_mem_buf_desc *descs;
- u32 chunk_size, max_entries, i = 0;
+ u32 chunk_size, max_entries;
+ int i = 0;
void **bufs;
- u64 size, tmp;
+ u64 size = 0, tmp;
/* start big and work our way down */
chunk_size = min(preferred, (u64)PAGE_SIZE << MAX_ORDER);