From: Colin King <colin.king@canonical.com>
To: Coly Li <colyli@suse.de>,
Kent Overstreet <kent.overstreet@gmail.com>,
Jens Axboe <axboe@kernel.dk>, Jianpeng Ma <jianpeng.ma@intel.com>,
linux-bcache@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH][next] bcache: Set error return err to -ENOMEM on allocation failure
Date: Mon, 19 Apr 2021 13:56:27 +0100 [thread overview]
Message-ID: <20210419125628.177047-1-colin.king@canonical.com> (raw)
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>
---
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.30.2
next reply other threads:[~2021-04-19 12:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-19 12:56 Colin King [this message]
2021-04-19 16:04 ` [PATCH][next] bcache: Set error return err to -ENOMEM on allocation failure Coly Li
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=20210419125628.177047-1-colin.king@canonical.com \
--to=colin.king@canonical.com \
--cc=axboe@kernel.dk \
--cc=colyli@suse.de \
--cc=jianpeng.ma@intel.com \
--cc=kent.overstreet@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-kernel@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).