From: Dan Carpenter Date: Thu, 6 Jul 2017 09:26:52 +0000 (+0300) Subject: nvme-pci: compile warnings in nvme_alloc_host_mem() X-Git-Tag: v4.13-rc1~56^2~1^2~2 X-Git-Url: https://git.kernelconcepts.de/?a=commitdiff_plain;h=2ee0e4ed5ca24c0642a7b72d75b4fe6dfc0a8db8;p=karo-tx-linux.git 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 Reviewed-by: Christoph Hellwig Signed-off-by: Sagi Grimberg --- 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);