All of lore.kernel.org
 help / color / mirror / Atom feed
From: Javier Gonzalez <javier@javigon.com>
To: m@bjorling.me
Cc: javier@javigon.com, linux-kernel@vger.kernel.org,
	linux-block@vger.kernel.org,
	Javier Gonzalez <javier@cnexlabs.com>
Subject: [PATCH] lightnvm: add check after mempool allocation
Date: Tue, 15 Dec 2015 13:06:35 +0100	[thread overview]
Message-ID: <1450181195-24702-1-git-send-email-javier@javigon.com> (raw)

Add missing check after mempool allocation.

Signed-off-by: Javier Gonzalez <javier@cnexlabs.com>
---
 drivers/lightnvm/rrpc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c
index a1e7488..f4bc986 100644
--- a/drivers/lightnvm/rrpc.c
+++ b/drivers/lightnvm/rrpc.c
@@ -287,6 +287,8 @@ static int rrpc_move_valid_pages(struct rrpc *rrpc, struct rrpc_block *rblk)
 	}
 
 	page = mempool_alloc(rrpc->page_pool, GFP_NOIO);
+	if (!page)
+		return -ENOMEM;
 
 	while ((slot = find_first_zero_bit(rblk->invalid_pages,
 					    nr_pgs_per_blk)) < nr_pgs_per_blk) {
-- 
2.1.4


             reply	other threads:[~2015-12-15 12:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-15 12:06 Javier Gonzalez [this message]
2015-12-15 12:11 ` [PATCH] lightnvm: add check after mempool allocation Matias Bjørling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1450181195-24702-1-git-send-email-javier@javigon.com \
    --to=javier@javigon.com \
    --cc=javier@cnexlabs.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m@bjorling.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.