mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] NVMe: check the return of nvme_alloc_iod
@ 2012-10-18 10:43 Yuanhan Liu
  0 siblings, 0 replies; only message in thread
From: Yuanhan Liu @ 2012-10-18 10:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: fengguang.wu, Yuanhan Liu, Matthew Wilcox, Keith Busch

It maybe failed due to out of memory.

Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>
Cc: Keith Busch <keith.busch@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 drivers/block/nvme.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c
index 931769e..eb58978 100644
--- a/drivers/block/nvme.c
+++ b/drivers/block/nvme.c
@@ -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++) {
-- 
1.7.7.6


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-10-18 10:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-18 10:43 [PATCH] NVMe: check the return of nvme_alloc_iod Yuanhan Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®