Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2ee0e4ed authored by Dan Carpenter's avatar Dan Carpenter Committed by Sagi Grimberg
Browse files

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: 87ad72a5 ("nvme-pci: implement host memory buffer support")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
parent 4cb7ca80
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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);