linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Oleg Drokin <oleg.drokin@intel.com>,
	Patrick Farrell <paf@cray.com>,
	lustre-devel@lists.lustre.org, Bobi Jam <bobijam@hotmail.com>,
	James Simmons <uja.ornl@yahoo.com>, Olaf Weber <olaf@sgi.com>,
	James Simmons <jsimmons@infradead.org>,
	Jinshan Xiong <jinshan.xiong@intel.com>,
	"John L . Hammond" <john.hammond@intel.com>,
	Liang Zhen <liang.zhen@intel.com>, Arnd Bergmann <arnd@arndb.de>,
	Andreas Dilger <andreas.dilger@intel.com>,
	Shivani Bhardwaj <shivanib134@gmail.com>,
	Andriy Skulysh <Andriy_Skulysh@xyratex.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/2] staging: lustre: remove broken dead code in cfs_cpt_table_create_pattern
Date: Tue, 25 Oct 2016 23:22:30 +0200	[thread overview]
Message-ID: <20161025212310.2346367-1-arnd@arndb.de> (raw)

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")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 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 464b27923ac0..6a31521f6ae0 100644
--- a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c
+++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c
@@ -829,13 +829,6 @@ cfs_cpt_table_create_pattern(char *pattern)
 	int			c;
 	int i;
 
-	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

             reply	other threads:[~2016-10-25 21:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-25 21:22 Arnd Bergmann [this message]
2016-10-25 21:22 ` [PATCH v2 2/2] staging: lustre: restore initialization of return code Arnd Bergmann
2016-10-27 13:12 ` [PATCH v2 1/2] staging: lustre: remove broken dead code in cfs_cpt_table_create_pattern Greg Kroah-Hartman
2016-10-27 13:36   ` Arnd Bergmann

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=20161025212310.2346367-1-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=Andriy_Skulysh@xyratex.com \
    --cc=andreas.dilger@intel.com \
    --cc=bobijam@hotmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jinshan.xiong@intel.com \
    --cc=john.hammond@intel.com \
    --cc=jsimmons@infradead.org \
    --cc=liang.zhen@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lustre-devel@lists.lustre.org \
    --cc=olaf@sgi.com \
    --cc=oleg.drokin@intel.com \
    --cc=paf@cray.com \
    --cc=shivanib134@gmail.com \
    --cc=uja.ornl@yahoo.com \
    /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;
as well as URLs for NNTP newsgroup(s).