From patchwork Tue Dec 15 12:06:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Javier_Gonz=C3=A1lez?= X-Patchwork-Id: 7854051 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BECAFBEEE1 for ; Tue, 15 Dec 2015 12:07:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EB3EA20304 for ; Tue, 15 Dec 2015 12:07:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D841D2024D for ; Tue, 15 Dec 2015 12:07:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965049AbbLOMHG (ORCPT ); Tue, 15 Dec 2015 07:07:06 -0500 Received: from mail-wm0-f48.google.com ([74.125.82.48]:38645 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964921AbbLOMHF (ORCPT ); Tue, 15 Dec 2015 07:07:05 -0500 Received: by mail-wm0-f48.google.com with SMTP id p66so22056941wmp.1 for ; Tue, 15 Dec 2015 04:07:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=javigon-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=jDWkYn33Gv0gdr54eOer3nB+Hfwi2oK2tNKP5MjuVps=; b=zMED9bJcteLrjZ63bOtvlwhnMFnn/NpxbHq3nFyvrslef9XSSkkcJnAwHGa1ZNLl8A CUEsvVfnyEOeleoa5p0lAGrwfAsdVjGOvER0wj4u3OFqDVIQmDWOnSmkdFLmDrsNT4vb qyyPsPsSHEH4vG9XeZEClzll3Q6y4UG4Ov9wkShwqLIdnfqFgOcLbodK/kgJUdkyS3Ba rA4uYWz7vf6svxzIAR6Wdq6YGEMiSjicu2B/81+QG9/j0XABtGPpdCDJsKc5pQKzSsTB twyAbagcV9jvW7m4KpNYWnJ8dQXBe70N54lAtYsCtxGehdjGJGGnSlCxVPxvAUnpeB0S fLYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=jDWkYn33Gv0gdr54eOer3nB+Hfwi2oK2tNKP5MjuVps=; b=aVVC+k/R47T76/8oeb10BEOi2WaWrt3usuYoeggeegWpdeAkTCnPW/l13QrdxuMINr 11sHXVX3vJO4zASeXirpUNrM8UuzuI30eafOEelo3Qe8JH1TFHm5dbQdfUgfyo5ABrmN hYp31vBWkcFKPBBqOcurWvEAMV8H6hvOtue3L1j9po1fOWGdVgdmXkE5mxXkTpahxmWa ZacxK6YM8EfDfC//PmXQZ1DWdikoQT54A4igPU8m15P2dVkU3KGLM1ncv+us/UHZrP4y LHmPgYMI6N6CVDeJWuuFrJ2+W36IqPwrFSBqTos+mrT4RNVUUQWmtyFTH6t7geBcvuyM qNow== X-Gm-Message-State: ALoCoQn/xNF+kHwYqw+8G+Vdok9uSPBOrRO9kgEAelAVEXb4Mdq/qD/Ja3jAeTLf0r6+leBH+5iELw+mXhKc6TDvpllaa7rSEw== X-Received: by 10.28.21.196 with SMTP id 187mr4360067wmv.82.1450181223340; Tue, 15 Dec 2015 04:07:03 -0800 (PST) Received: from localhost.localdomain (6164198-cl69.boa.fiberby.dk. [193.106.164.198]) by smtp.gmail.com with ESMTPSA id a63sm20609603wmc.5.2015.12.15.04.07.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 15 Dec 2015 04:07:02 -0800 (PST) From: Javier Gonzalez To: m@bjorling.me Cc: javier@javigon.com, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Javier Gonzalez Subject: [PATCH] lightnvm: add check after mempool allocation Date: Tue, 15 Dec 2015 13:06:35 +0100 Message-Id: <1450181195-24702-1-git-send-email-javier@javigon.com> X-Mailer: git-send-email 2.1.4 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add missing check after mempool allocation. Signed-off-by: Javier Gonzalez --- 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) {