Skip to contentSkip to conversation

NVMe: check the return of nvme_alloc_iod

PATCH New Yuanhan Liu 1 participant 1 message Oct 18, 2012 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NVMe: check the return of nvme_alloc_iod

It maybe failed due to out of memory.

Cc Matthew Wilcox <[email protected]>
Cc Keith Busch <[email protected]>
---
 drivers/block/nvme.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/block/nvme.c +4 -0
index 931769e..eb58978 100644
@@ -1091,6 +1091,10 @@ static struct nvme_iod *nvme_map_user_pages(struct nvme_dev *dev, int write,
 	}
 
 	iod = nvme_alloc_iod(count, length, GFP_KERNEL);
+	if (!iod) {
+		err = -ENOMEM;
+		goto put_pages;
+	}
 	sg = iod->sg;
 	sg_init_table(sg, count);
 	for (i = 0; i < count; i++) {
Signature · 1 line
1.7.7.6