Received: by 10.223.148.5 with SMTP id 5csp5986719wrq; Wed, 17 Jan 2018 08:06:51 -0800 (PST) X-Google-Smtp-Source: ACJfBotmI6aAbK1e3RkEB//3QQsU+n/ftAc7c66U1CmLFo+1f+57Bf4eMCa0rbHPHKJXbzXFNkXF X-Received: by 10.99.102.1 with SMTP id a1mr5689530pgc.452.1516205211691; Wed, 17 Jan 2018 08:06:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516205211; cv=none; d=google.com; s=arc-20160816; b=GrFCGQ8+3CH2124r5oXR9df2xeJUeKtbdVnTCCU+f7fUharAimXIhaZCtTN7DYLrJj zpZM6uW0X2s7cc8iohHbeCOLl1+Tu9CDhPHiy5SvnFJ22SfNpiHfnsa8BDPKN1g3/t2x vL3pgDIpqOT2bWWnChPEMwMwtPONSH8WV/9HU0l9wR4BDBLs8/qjAUramGymeMwnDHrV 2KpRaK+8j/Hd4GDCWLNRZ0Hd+shGsN9DSEyrvqHpXRiU6tOpxPwwC8hJlmhPclxsg/gU G+10gcsKFqNWuNaYw+6vijJMxnWU4ai+LzsHDhem1wN9ukIWGGDku1OrUloE8PaVJPss yVWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=ysSKIeiWyPyh2Djkl2junwkMUBzuU0wI2gKWLT4+iJg=; b=XWGZC67MaCvBpKGK1EpzERAvExXuqx3rPmrslf5RfQqDUln0ls/1Wld911U6nmRYjw /OOVHhYv+zdQ06YQB/+8+z0XN7YzGTFy4ze2jsJledLO1DZ9fx39xRixYkuwKgS77Mu3 3fXYC6slhJbzCRdNgsoOAOXGi9tssjKCjVwq/Ovc8kI69cjL3BG2EV4ddi5b064pXAjF stZGf5PtSLkpCfZ5lVZquklqVt/tBQwW7Ap54W4EUmFPMpvSExlAzHaesy7Vsf5r6Cb4 UZ6sqLpZjbJXzi/m1kpzyZ924lYXZ2J4SAWLEeHcBD7uUnSa1XmlxpTgy6pTMeX6ypp7 MgHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=hEpjXT1W; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j2si4776572plk.264.2018.01.17.08.06.37; Wed, 17 Jan 2018 08:06:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=hEpjXT1W; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753778AbeAQQGD (ORCPT + 99 others); Wed, 17 Jan 2018 11:06:03 -0500 Received: from casper.infradead.org ([85.118.1.10]:38488 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753719AbeAQQGB (ORCPT ); Wed, 17 Jan 2018 11:06:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: Message-ID:In-Reply-To:Subject:cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ysSKIeiWyPyh2Djkl2junwkMUBzuU0wI2gKWLT4+iJg=; b=hEpjXT1W4XAi7UQreEooR3h+Y 5da/UO2O6U3NKjgjGWmOuSrYmk/3uYunml1gLdpFHvSGhZTP/j4sfd6BKTH+asXM4sd2ex3nG4RK5 aWeCYFRL25/tE7tRVvrrdQNb8DvAPSi914gozEzy8ZKg6sq2H2KIFyQcmPCPArO9QUGqgavgLuYaW wtba0rQ2F0xfGjZMhpG81tKw6et4xTfKZgsdLmzmJy8XC36bWax3LAZqat5Elv6Tjh9E0duOTigCa UbcBQJX/vPuDFVHuceZMrNVi0V+RSGsFeSGgTlYh4NTtvPVMMjkGsI0kfY/q+7p2YBa7cx0m8fiAF urAvbXG6g==; Received: from jsimmons (helo=localhost) by casper.infradead.org with local-esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ebqDh-0005oG-CJ; Wed, 17 Jan 2018 16:05:52 +0000 Date: Wed, 17 Jan 2018 16:05:45 +0000 (GMT) From: James Simmons To: Arnd Bergmann cc: Oleg Drokin , Andreas Dilger , Greg Kroah-Hartman , NeilBrown , Tejun Heo , lustre-devel@lists.lustre.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: lustre: lnet: avoid uninitialized return value In-Reply-To: <20180116093511.3197459-1-arnd@arndb.de> Message-ID: References: <20180116093511.3197459-1-arnd@arndb.de> User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180117_160545_460505_A4375B79 X-CRM114-Status: GOOD ( 15.75 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 NO_RELAYS Informational: message was not relayed via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 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 > Fixes: 6106c0f82481 ("staging: lustre: lnet: convert selftest to use workqueues") > Signed-off-by: Arnd Bergmann > --- > 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 > >