linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] staging: lustre: remove broken dead code in cfs_cpt_table_create_pattern
@ 2016-10-25 21:22 Arnd Bergmann
  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
  0 siblings, 2 replies; 4+ messages in thread
From: Arnd Bergmann @ 2016-10-25 21:22 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Oleg Drokin, Patrick Farrell, lustre-devel, Bobi Jam,
	James Simmons, Olaf Weber, James Simmons, Jinshan Xiong,
	John L . Hammond, Liang Zhen, Arnd Bergmann, Andreas Dilger,
	Shivani Bhardwaj, Andriy Skulysh, devel, linux-kernel

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] staging: lustre: restore initialization of return code
  2016-10-25 21:22 [PATCH v2 1/2] staging: lustre: remove broken dead code in cfs_cpt_table_create_pattern Arnd Bergmann
@ 2016-10-25 21:22 ` 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
  1 sibling, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2016-10-25 21:22 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Oleg Drokin, Patrick Farrell, lustre-devel, Bobi Jam,
	James Simmons, Olaf Weber, James Simmons, Jinshan Xiong,
	John L . Hammond, Liang Zhen, Arnd Bergmann, Andreas Dilger,
	Bobi Jam, devel, linux-kernel

A recent rework removed the initialization of the successful return
code from lov_getstripe:

drivers/staging/lustre/lustre/lov/lov_pack.c: In function 'lov_getstripe':
drivers/staging/lustre/lustre/lov/lov_pack.c:426:9: error: 'rc' may be used uninitialized in this function [-Werror=maybe-uninitialized]
drivers/staging/lustre/lustre/lov/lov_pack.c:313:6: note: 'rc' was declared here

This adds it back.

Fixes: e10a431b3fd0 ("staging: lustre: lov: move LSM to LOV layer")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/lustre/lustre/lov/lov_pack.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c
index 17bceadd66f8..ccc1fae35791 100644
--- a/drivers/staging/lustre/lustre/lov/lov_pack.c
+++ b/drivers/staging/lustre/lustre/lov/lov_pack.c
@@ -418,6 +418,8 @@ int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm,
 	((struct lov_user_md *)lmmk)->lmm_stripe_count = lum.lmm_stripe_count;
 	if (copy_to_user(lump, lmmk, lmm_size))
 		rc = -EFAULT;
+	else
+		rc = 0;
 
 out_free:
 	kvfree(lmmk);
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] staging: lustre: remove broken dead code in cfs_cpt_table_create_pattern
  2016-10-25 21:22 [PATCH v2 1/2] staging: lustre: remove broken dead code in cfs_cpt_table_create_pattern Arnd Bergmann
  2016-10-25 21:22 ` [PATCH v2 2/2] staging: lustre: restore initialization of return code Arnd Bergmann
@ 2016-10-27 13:12 ` Greg Kroah-Hartman
  2016-10-27 13:36   ` Arnd Bergmann
  1 sibling, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2016-10-27 13:12 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Oleg Drokin, Patrick Farrell, lustre-devel, Bobi Jam,
	James Simmons, Olaf Weber, James Simmons, Jinshan Xiong,
	John L . Hammond, Liang Zhen, Andreas Dilger, Shivani Bhardwaj,
	Andriy Skulysh, devel, linux-kernel

On Tue, Oct 25, 2016 at 11:22:30PM +0200, Arnd Bergmann wrote:
> 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(-)

Hm, I already applied the v1 versions of these, right?  What changed
with these, they seem identical to me...

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] staging: lustre: remove broken dead code in cfs_cpt_table_create_pattern
  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
  0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2016-10-27 13:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Oleg Drokin, Patrick Farrell, lustre-devel, Bobi Jam,
	James Simmons, Olaf Weber, James Simmons, Jinshan Xiong,
	John L . Hammond, Liang Zhen, Andreas Dilger, Shivani Bhardwaj,
	Andriy Skulysh, devel, linux-kernel

On Thursday, October 27, 2016 3:12:42 PM CEST Greg Kroah-Hartman wrote:
> On Tue, Oct 25, 2016 at 11:22:30PM +0200, Arnd Bergmann wrote:
> > 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(-)
> 
> Hm, I already applied the v1 versions of these, right?  What changed
> with these, they seem identical to me...

The patches you applied were fine, they just had not made it into linux-next
by Tuesday, and I thought they got lost as I had sent them as part of a longer
series and I screwed up one of the two changelogs initially (you applied the
fixed v2 patch I sent immediately afterwards).

Sorry about the confusion.

	Arnd

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-27 13:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-25 21:22 [PATCH v2 1/2] staging: lustre: remove broken dead code in cfs_cpt_table_create_pattern Arnd Bergmann
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

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).