From: Coly Li <colyli@suse.de>
To: axboe@kernel.dk
Cc: linux-bcache@vger.kernel.org, linux-block@vger.kernel.org,
Colin Ian King <colin.king@canonical.com>,
Coly Li <colyli@suse.de>
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: <20210420044452.88267-3-colyli@suse.de> (raw)
In-Reply-To: <20210420044452.88267-1-colyli@suse.de>
From: Colin Ian King <colin.king@canonical.com>
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 <colin.king@canonical.com>
Signed-off-by: Coly Li <colyli@suse.de>
---
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;
--
2.26.2
prev 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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210420044452.88267-3-colyli@suse.de \
--to=colyli@suse.de \
--cc=axboe@kernel.dk \
--cc=colin.king@canonical.com \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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).