public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lightnvm: add check after mempool allocation
@ 2015-12-15 12:06 Javier Gonzalez
  2015-12-15 12:11 ` Matias Bjørling
  0 siblings, 1 reply; 2+ messages in thread
From: Javier Gonzalez @ 2015-12-15 12:06 UTC (permalink / raw)
  To: m; +Cc: javier, linux-kernel, linux-block, Javier Gonzalez

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] lightnvm: add check after mempool allocation
  2015-12-15 12:06 [PATCH] lightnvm: add check after mempool allocation Javier Gonzalez
@ 2015-12-15 12:11 ` Matias Bjørling
  0 siblings, 0 replies; 2+ messages in thread
From: Matias Bjørling @ 2015-12-15 12:11 UTC (permalink / raw)
  To: Javier Gonzalez; +Cc: linux-kernel, linux-block

On 12/15/2015 01:06 PM, Javier Gonzalez wrote:
> 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) {
>
Thanks Javier, applied for 4.5.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-15 12:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-15 12:06 [PATCH] lightnvm: add check after mempool allocation Javier Gonzalez
2015-12-15 12:11 ` Matias Bjørling

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