archive mirror
 help / color / mirror / Atom feed
From: Coly Li <>
	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	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

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;

      parent reply	other threads:[~2021-04-20  4:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20  4:44 [PATCH 0/2] bcache patches for Linux v5.13 - 3rd wave Coly Li
2021-04-20  4:44 ` [PATCH 1/2] bcache: Kconfig dependence fix for NVDIMM support Coly Li
2021-04-20  5:36   ` Randy Dunlap
2021-04-20  4:44 ` Coly Li [this message]

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:

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

  git send-email \ \ \ \ \ \ \

* 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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).