* [PATCH][next] bcache: Set error return err to -ENOMEM on allocation failure
@ 2021-04-19 12:56 Colin King
2021-04-19 16:04 ` Coly Li
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2021-04-19 12:56 UTC (permalink / raw)
To: Coly Li, Kent Overstreet, Jens Axboe, Jianpeng Ma, linux-bcache
Cc: kernel-janitors, linux-kernel
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][next] bcache: Set error return err to -ENOMEM on allocation failure
2021-04-19 12:56 [PATCH][next] bcache: Set error return err to -ENOMEM on allocation failure Colin King
@ 2021-04-19 16:04 ` Coly Li
0 siblings, 0 replies; 2+ messages in thread
From: Coly Li @ 2021-04-19 16:04 UTC (permalink / raw)
To: Colin King
Cc: kernel-janitors, linux-kernel, linux-bcache, Jianpeng Ma,
Jens Axboe, Kent Overstreet
On 4/19/21 8:56 PM, Colin King wrote:
> 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;
>
Copied, added into my queue for rc1.
Thanks.
Coly Li
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-19 16:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-19 12:56 [PATCH][next] bcache: Set error return err to -ENOMEM on allocation failure Colin King
2021-04-19 16:04 ` Coly Li
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).