From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757515AbcJQWKf (ORCPT ); Mon, 17 Oct 2016 18:10:35 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:54853 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753309AbcJQWK2 (ORCPT ); Mon, 17 Oct 2016 18:10:28 -0400 From: Arnd Bergmann To: Oleg Drokin Cc: Linus Torvalds , linux-kernel@vger.kernel.org, Arnd Bergmann , Liang Zhen , James Simmons , Andreas Dilger , Greg Kroah-Hartman , lustre-devel@lists.lustre.org, devel@driverdev.osuosl.org Subject: [PATCH 09/28] staging: lustre: remove broken dead code in cfs_cpt_table_create_pattern Date: Tue, 18 Oct 2016 00:08:56 +0200 Message-Id: <20161017220903.1746743-3-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20161017220342.1627073-1-arnd@arndb.de> References: <20161017220342.1627073-1-arnd@arndb.de> X-Provags-ID: V03:K0:ZkvmL5kbxyGdJr4BOPc2+sqiDz88kg4AlgRyMWh85CkcAa0Ye3e lOED6s+m+boMjCQ7cRHIc2OILq07jpMuN8KSiSX6wrZn3u9P588PcM6Vov2EoShcOOowApO C7mamh6nbEpKp8V9T3F/Lc53L5pHE86WR3PsjKNYCFERNsgfbOowpwQDUTKI2mUezwUWY9D P+WixKxJwROTb0TMtCp6A== X-UI-Out-Filterresults: notjunk:1;V01:K0:z4HeOwnHHJM=:5G5VOwM6v86sAnPJRUuKQw eV06odCNvEL/MNhY7YXXi0AobSVFN05obDboz/xI4xnEoZGxr4Mhmj+voX2oYlhsxP/fuxPdB 2XVkhW+9vg9yxlBwRJw7KaCo7Bd0eMuELMcviWdrx2G4pbNbU4yKh/mlV2Hdekop1J7cPYSVt gT2bSH5bEGMag58ESUIMfT1J77FR0TEWW7IcaOCxVCWelrmL9/b3PZRftJh4h6hHJO8Yxcv38 SLTvqOktYUGjvb8hCu43TGbGP8wP82YdRlnocFlS4/t3avI/9goKJ3n3kwl3Ud9zzWpE+wAcQ VgTT57MSjQ3lHnZIdwU8/oOuIA6rnh3fg+b2OKFc5/UJiJkVO/g9amoJpZwTQpBvxRXz/jsMk LiMi6unr3MMFAQdihVGM9uqjaHtu8OQcJ5JZAe31128G06S4Tnz/T5MtZw4VNGjDoq7ayObaQ hZ4MK1rbVSd8nQk3SZpceHIGWRLbxXfDbS38xOdZAQLtIp9f2nDn+RPTM41VAxOng/EDqryn3 OWyyLQL/eEbMz0IFl26aKj7gznQNhbjl/bB9ikghtgvWp0ZDlyfekX20bkCKUCGHFwUXU2P4h Gix55GLkdIXbWD6QBLlmfLjY6ys3ZVhnSYwmE51GfkwfsIIx700uzWpqHk3gHuVOx4bwWqVlt FJ5P0sLod2mQZsbt8euhQ/CABAE2gwONXioi37HaenXFkdxYZbIeTTH3A4MTayxvNzwo= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After a recent bugfix, we get a warning about the use of an uninitialized variable: drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c: In function 'cfs_cpt_table_create_pattern': drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c:833:7: error: 'str' may be used uninitialized in this function [-Werror=maybe-uninitialized] This part of the function used to not do anything as we would reassign the 'str' pointer to something else right away, but now we pass an uninitialized pointer into 'strchr', which can cause a kernel page fault or worse. Fixes: 239fd5d41f9b ("staging: lustre: libcfs: shortcut to create CPT from NUMA topology") Cc: Liang Zhen Cc: James Simmons Signed-off-by: Arnd Bergmann --- drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c index e8b1a61..1226cba 100644 --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c @@ -824,13 +824,6 @@ cfs_cpt_table_create_pattern(char *pattern) int ncpt; int c; - for (ncpt = 0;; ncpt++) { /* quick scan bracket */ - str = strchr(str, '['); - if (!str) - break; - str++; - } - str = cfs_trimwhite(pattern); if (*str == 'n' || *str == 'N') { pattern = str + 1; -- 2.9.0 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Date: Tue, 18 Oct 2016 00:08:56 +0200 Subject: [lustre-devel] [PATCH 09/28] staging: lustre: remove broken dead code in cfs_cpt_table_create_pattern In-Reply-To: <20161017220342.1627073-1-arnd@arndb.de> References: <20161017220342.1627073-1-arnd@arndb.de> Message-ID: <20161017220903.1746743-3-arnd@arndb.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Oleg Drokin Cc: Linus Torvalds , linux-kernel@vger.kernel.org, Arnd Bergmann , Liang Zhen , James Simmons , Andreas Dilger , Greg Kroah-Hartman , lustre-devel@lists.lustre.org, devel@driverdev.osuosl.org After a recent bugfix, we get a warning about the use of an uninitialized variable: drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c: In function 'cfs_cpt_table_create_pattern': drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c:833:7: error: 'str' may be used uninitialized in this function [-Werror=maybe-uninitialized] This part of the function used to not do anything as we would reassign the 'str' pointer to something else right away, but now we pass an uninitialized pointer into 'strchr', which can cause a kernel page fault or worse. Fixes: 239fd5d41f9b ("staging: lustre: libcfs: shortcut to create CPT from NUMA topology") Cc: Liang Zhen Cc: James Simmons Signed-off-by: Arnd Bergmann --- drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c index e8b1a61..1226cba 100644 --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c @@ -824,13 +824,6 @@ cfs_cpt_table_create_pattern(char *pattern) int ncpt; int c; - for (ncpt = 0;; ncpt++) { /* quick scan bracket */ - str = strchr(str, '['); - if (!str) - break; - str++; - } - str = cfs_trimwhite(pattern); if (*str == 'n' || *str == 'N') { pattern = str + 1; -- 2.9.0