From patchwork Tue Apr 20 04:44:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Coly Li X-Patchwork-Id: 12213329 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFE16C433B4 for ; Tue, 20 Apr 2021 04:47:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6D35A613AE for ; Tue, 20 Apr 2021 04:47:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229485AbhDTErc (ORCPT ); Tue, 20 Apr 2021 00:47:32 -0400 Received: from mx2.suse.de ([195.135.220.15]:40794 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229619AbhDTErV (ORCPT ); Tue, 20 Apr 2021 00:47:21 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id BE93DB15E; Tue, 20 Apr 2021 04:45:42 +0000 (UTC) From: Coly Li To: axboe@kernel.dk Cc: linux-bcache@vger.kernel.org, linux-block@vger.kernel.org, Coly Li , Randy Dunlap Subject: [PATCH 1/2] bcache: Kconfig dependence fix for NVDIMM support Date: Tue, 20 Apr 2021 12:44:51 +0800 Message-Id: <20210420044452.88267-2-colyli@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210420044452.88267-1-colyli@suse.de> References: <20210420044452.88267-1-colyli@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org In drivers/md/bcache/Kconfig, setting BCACHE_NVM_PAGES to "selected" LIBNVDIMM and DAX is improper. This patch changes to Kconfig dependance from "selected" to "depends on" for LIBNVDIMM and DAX. Reported-by: Randy Dunlap Cc: Jens Axboe Signed-off-by: Coly Li Acked-by: Randy Dunlap # build-tested --- drivers/md/bcache/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/bcache/Kconfig b/drivers/md/bcache/Kconfig index 0996e366ad0b..59999f24d89e 100644 --- a/drivers/md/bcache/Kconfig +++ b/drivers/md/bcache/Kconfig @@ -40,7 +40,7 @@ config BCACHE_NVM_PAGES bool "NVDIMM support for bcache (EXPERIMENTAL)" depends on BCACHE depends on PHYS_ADDR_T_64BIT - select LIBNVDIMM - select DAX + depends on LIBNVDIMM + depends on DAX help nvm pages allocator for bcache. From patchwork Tue Apr 20 04:44:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Coly Li X-Patchwork-Id: 12213331 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C11EC43460 for ; Tue, 20 Apr 2021 04:47:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 53331613AE for ; Tue, 20 Apr 2021 04:47:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229838AbhDTErd (ORCPT ); Tue, 20 Apr 2021 00:47:33 -0400 Received: from mx2.suse.de ([195.135.220.15]:40818 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229786AbhDTErd (ORCPT ); Tue, 20 Apr 2021 00:47:33 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 72D95B1C9; Tue, 20 Apr 2021 04:45:45 +0000 (UTC) From: Coly Li To: axboe@kernel.dk Cc: linux-bcache@vger.kernel.org, linux-block@vger.kernel.org, Colin Ian King , Coly Li Subject: [PATCH 2/2] bcache: Set error return err to -ENOMEM on allocation failure Date: Tue, 20 Apr 2021 12:44:52 +0800 Message-Id: <20210420044452.88267-3-colyli@suse.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210420044452.88267-1-colyli@suse.de> References: <20210420044452.88267-1-colyli@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Colin Ian King Currently when ns fails to be allocated the error return path returns an uninitialized return code in variable 'err'. Fix this by setting err to -ENOMEM. Addresses-Coverity: ("Uninitialized scalar variable") Fixes: 688330711e9a ("bcache: initialize the nvm pages allocator") Signed-off-by: Colin Ian King Signed-off-by: Coly Li --- drivers/md/bcache/nvm-pages.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/md/bcache/nvm-pages.c b/drivers/md/bcache/nvm-pages.c index 08cd45e90481..2e124d546099 100644 --- a/drivers/md/bcache/nvm-pages.c +++ b/drivers/md/bcache/nvm-pages.c @@ -584,6 +584,7 @@ struct bch_nvm_namespace *bch_register_namespace(const char *dev_path) return ERR_PTR(PTR_ERR(bdev)); } + err = -ENOMEM; ns = kzalloc(sizeof(struct bch_nvm_namespace), GFP_KERNEL); if (!ns) goto bdput;