Skip to contentSkip to conversation

lightnvm: add check after mempool allocation

PATCH In review Javier Gonzalez 2 participants 2 messages Dec 15, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lightnvm: add check after mempool allocation

Add missing check after mempool allocation.

---
 drivers/lightnvm/rrpc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/lightnvm/rrpc.c +2 -0
index a1e7488..f4bc986 100644
@@ -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) {
Signature · 1 line
2.1.4
#1 lore raw
Quoted 13 lines · Javier Gonzalez

Add missing check after mempool allocation.

---
  drivers/lightnvm/rrpc.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/lightnvm/rrpc.c +0 -0
index a1e7488..f4bc986 100644

drivers/lightnvm/rrpc.c static int rrpc_move_valid_pages(struct rrpc *rrpc, struct rrpc_block *rblk) · line 294

Quoted 8 lines
drivers/lightnvm/rrpc.c +2 -0
@@ -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) {

Thanks Javier, applied for 4.5.