From: James Simmons <jsimmons@infradead.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Oleg Drokin <oleg.drokin@intel.com>,
Andreas Dilger <andreas.dilger@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
NeilBrown <neilb@suse.com>, Tejun Heo <tj@kernel.org>,
lustre-devel@lists.lustre.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: lustre: lnet: avoid uninitialized return value
Date: Wed, 17 Jan 2018 16:05:45 +0000 (GMT) [thread overview]
Message-ID: <alpine.LFD.2.21.1801171604320.11282@casper.infradead.org> (raw)
In-Reply-To: <20180116093511.3197459-1-arnd@arndb.de>
> gcc warns that the latest workqueue change leads to returning an
> uninitialized variable:
>
> drivers/staging/lustre/lnet/selftest/module.c: In function 'lnet_selftest_init':
> drivers/staging/lustre/lnet/selftest/module.c:98:10: error: 'rc' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>
> A failure from alloc_ordered_workqueue() tends to indicate an
> out-of-memory condition, so return -ENOMEM in both cases.
> The second error path was a preexisting bug, where we always
> returned zero after a kvmalloc_array() failure.
Reviewed-by: James Simmons <jsimmons@infradead.org>
> Fixes: 6106c0f82481 ("staging: lustre: lnet: convert selftest to use workqueues")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/staging/lustre/lnet/selftest/module.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/lustre/lnet/selftest/module.c b/drivers/staging/lustre/lnet/selftest/module.c
> index aa6bfd5baf2f..c8d999e64f28 100644
> --- a/drivers/staging/lustre/lnet/selftest/module.c
> +++ b/drivers/staging/lustre/lnet/selftest/module.c
> @@ -95,15 +95,17 @@ lnet_selftest_init(void)
> lst_serial_wq = alloc_ordered_workqueue("lst_s", 0);
> if (!lst_serial_wq) {
> CERROR("Failed to create serial WI scheduler for LST\n");
> - return rc;
> + return -ENOMEM;
> }
> lst_init_step = LST_INIT_WI_SERIAL;
>
> nscheds = cfs_cpt_number(lnet_cpt_table());
> lst_test_wq = kvmalloc_array(nscheds, sizeof(lst_test_wq[0]),
> GFP_KERNEL | __GFP_ZERO);
> - if (!lst_test_wq)
> + if (!lst_test_wq) {
> + rc = -ENOMEM;
> goto error;
> + }
>
> lst_init_step = LST_INIT_WI_TEST;
> for (i = 0; i < nscheds; i++) {
> @@ -116,6 +118,7 @@ lnet_selftest_init(void)
> if (!lst_test_wq[i]) {
> CWARN("Failed to create CPU partition affinity WI scheduler %d for LST\n",
> i);
> + rc = -ENOMEM;
> goto error;
> }
> attrs.nice = 0;
> --
> 2.9.0
>
>
prev parent reply other threads:[~2018-01-17 16:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-16 9:34 Arnd Bergmann
2018-01-17 16:05 ` James Simmons [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=alpine.LFD.2.21.1801171604320.11282@casper.infradead.org \
--to=jsimmons@infradead.org \
--cc=andreas.dilger@intel.com \
--cc=arnd@arndb.de \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lustre-devel@lists.lustre.org \
--cc=neilb@suse.com \
--cc=oleg.drokin@intel.com \
--cc=tj@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
all inboxes | Powered by JetHome®