From patchwork Tue Jan 16 09:34:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 124649 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp951649lje; Tue, 16 Jan 2018 01:36:51 -0800 (PST) X-Google-Smtp-Source: ACJfBotgZMmYf+B8ouy4nQ/PHudBsaXFagU1/yByVhVEJGMOd62P3mAWLtoqtNyq3PA+aHhpCeyu X-Received: by 10.159.207.135 with SMTP id z7mr2629784plo.242.1516095411546; Tue, 16 Jan 2018 01:36:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516095411; cv=none; d=google.com; s=arc-20160816; b=mFlSHFUw4sc/aTCnUhJFpBOw5vpiHh7xLH4zlX9Zd75j6ZSnqCf/34aOu6K4LhAGqh JX4vxfgvOf8XPjbrCtlfDxv6bx16FfeS6NcUEiDTwXh8/HnN+h5nn8fe/kVL5pEhw9DI wNfM2IpwItd0ttj2eRUszbTeOUCWK6kBlOwjasTWqbbtQsWvjK5ct1y26sJcUbyNJazv WwYn8ruQ9+a4y7iIyr4SQ2VQGGdgkcPMTYVn8Yv5gcmXOWPRoN2OMeyKhZv0X4jKyCCp RWoKQieZPJobmpcB/3yCZL0fR9TLXz+cMGAg9yMtiSNioM5Lp6V2OXTfs7qTqtGjvl8i wEig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=9v6Qv5P7ZigjpbKdk0atlcD1XyJwx7qBDXBAw64JF3A=; b=kE+Jey+MCKrQB/9v7vcmRHlbqsUaD5m+Vg5FCHAvz9/f0e/pyQsO8n0OWCPS1m/o93 iYAVThaCErLNpddY0MjUEjnTzETsziMXhnHx1eO39nV4hunKQKbZwa/lKLNG/xMJgCtz 0eIrkMUJVv2FBIArWmxTC+ENVVr5tCYrA9KhpyqMtqM4G3togIJIHMP0ssi+TvcXjyUN yCrNeSlWO5bo7r2/07UYlYpj6J/+L2XB81Nv2Uim0HKEZKDV+ucIDYBET3f2tj7OnOFO MO9Gvk4jwbIAeARElNjHTh7/NEes1+f2tYrp7uhhK/MG5NsGLX9z/W+oXdL/JK4fNyPZ mrTA== ARC-Authentication-Results: i=1; mx.google.com; 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 16si1311955pga.813.2018.01.16.01.36.51; Tue, 16 Jan 2018 01:36: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; 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 S1751195AbeAPJgt (ORCPT + 28 others); Tue, 16 Jan 2018 04:36:49 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:63765 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750802AbeAPJgr (ORCPT ); Tue, 16 Jan 2018 04:36:47 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue003 [212.227.15.129]) with ESMTPA (Nemesis) id 0MWfUd-1eMFDM0uyJ-00Xpx6; Tue, 16 Jan 2018 10:35:15 +0100 From: Arnd Bergmann To: Oleg Drokin , Andreas Dilger , James Simmons , Greg Kroah-Hartman Cc: Arnd Bergmann , NeilBrown , Tejun Heo , lustre-devel@lists.lustre.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: lustre: lnet: avoid uninitialized return value Date: Tue, 16 Jan 2018 10:34:25 +0100 Message-Id: <20180116093511.3197459-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:5nTZiu0mg8fN/mu8biequ7YqlIucks9WQGQ9AbQfNwUSfKN75wI 9DjuoSNephGwYrd529UW3rsOftzhZC5z1vk3FgBjfkHpNgBczCv+ifWo1gGxiKTPOkD9etP EJps+vcr9Odu1NxPMIL3FiPvJPVaLXNtH+KxVjwP8hIIi91xEbhpyt4LqKUJH+e+ZqLAubs uhnmPvys9672hiIt3DkOw== X-UI-Out-Filterresults: notjunk:1; V01:K0:HbegAOL8MCs=:MKk2TVjKg5v8dzwg9KsMrB 0Frnlt0fqDVtWEv+OlC280s+CHxOZy6vBN1DWWrSl8tOeNcpqiNzpAJRbXLSJewLPIUR7kSq3 mU2NcTpXVBt+FTl2Sb6iXJ3vkXkQRjUMgxIZU90az1yXHPWpJn7JtJI9vE7HsF85yn5EueXeR 69in2TXfTX/Uu27Y+Z7R8deUvgIOZM7niBEOYmRBIEDwqc0Zpr9EHEwwONuiWPO0VP3hSOtUF zUU4z4qIhLfj4jRMJVVPOdAOAWD7EVzjTPAjUcU3J0NoaujqI3BDH3/pPun51Y33dWPGwpigi WFTNr65/evDc6NmcBD7UBH9oHEg1DJ/62NuLRawDkfxnkfP9Y+CRUvYd1xwhjvCssGhbgmJBB Jr8btKmCv8P1HrT2syQRzM22vI4ObZiDIgjS2wsy92uaD34l9BKOUDQvJJZtDaTS0NcAqS95S 57bgMuHRSMu2Wb3EugytERwucnuGdGmZpAcwoIZGbZ9YxQ9+FJ9xd//zNy209ThYXkFYoDSpu G7rlhqJsZEV9h/jYJBgzeqQIeX3iLpN0aiIt4o3Dcwqm82ROFK/x2JoSoXZq+maq8xcIbe4n8 v40nmktZnlmaXo9HhsyJLaQdLs5fxGCwa6FfWDmU+6/6pO+QTJqv84oOBhRJI664HE90Ro8xK MOxSt6mOPFpfmO7GnN0f7oOu9TUlM9x9Wk2w3FBV68wyO/MTzWolq01TZVPB8lRI8Zqb9TCbA XCjE8UKxvUg6aQr4n7FO/4hkvSUDkw5dNtkWWw== 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. 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(-) -- 2.9.0 Reviewed-by: James Simmons 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;