All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs/proc/task_mmu.c: fix uninitalized variable warning
@ 2019-04-18  1:20 Alakesh Haloi
  2019-04-18  6:56 ` Greg Kroah-Hartman
  2019-04-18 22:34 ` Andrew Morton
  0 siblings, 2 replies; 6+ messages in thread
From: Alakesh Haloi @ 2019-04-18  1:20 UTC (permalink / raw)
  To: stable
  Cc: Andrew Morton, Greg Kroah-Hartman, Vlastimil Babka, Huang Ying,
	Sasha Levin, Sandeep Patil

This patch fixes the following uninitialized variable warning

fs/proc/task_mmu.c: In function 'show_smap.isra.33':
fs/proc/task_mmu.c:761:7: warning: 'last_vma' may be used uninitialized in this function [-Wmaybe-uninitialized]
  bool last_vma;
       ^~~~~~~~

Cc: stable@vger.kernel.org # 4.14.x
Signed-off-by: Alakesh Haloi <alakesh.haloi@gmail.com>
---
 fs/proc/task_mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 5e63c459dc61..50fc311ee458 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -758,7 +758,7 @@ static int show_smap(struct seq_file *m, void *v, int is_pid)
 	};
 	int ret = 0;
 	bool rollup_mode;
-	bool last_vma;
+	bool uninitialized_var(last_vma);
 
 	if (priv->rollup) {
 		rollup_mode = true;
-- 
2.17.2


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

* Re: [PATCH] fs/proc/task_mmu.c: fix uninitalized variable warning
  2019-04-18  1:20 [PATCH] fs/proc/task_mmu.c: fix uninitalized variable warning Alakesh Haloi
@ 2019-04-18  6:56 ` Greg Kroah-Hartman
  2019-04-18 22:34 ` Andrew Morton
  1 sibling, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2019-04-18  6:56 UTC (permalink / raw)
  To: Alakesh Haloi
  Cc: stable, Andrew Morton, Vlastimil Babka, Huang Ying, Sasha Levin,
	Sandeep Patil

On Thu, Apr 18, 2019 at 01:20:12AM +0000, Alakesh Haloi wrote:
> This patch fixes the following uninitialized variable warning
> 
> fs/proc/task_mmu.c: In function 'show_smap.isra.33':
> fs/proc/task_mmu.c:761:7: warning: 'last_vma' may be used uninitialized in this function [-Wmaybe-uninitialized]
>   bool last_vma;
>        ^~~~~~~~
> 
> Cc: stable@vger.kernel.org # 4.14.x
> Signed-off-by: Alakesh Haloi <alakesh.haloi@gmail.com>
> ---
>  fs/proc/task_mmu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

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

* Re: [PATCH] fs/proc/task_mmu.c: fix uninitalized variable warning
  2019-04-18  1:20 [PATCH] fs/proc/task_mmu.c: fix uninitalized variable warning Alakesh Haloi
  2019-04-18  6:56 ` Greg Kroah-Hartman
@ 2019-04-18 22:34 ` Andrew Morton
  2019-04-25  0:34   ` Alakesh Haloi
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2019-04-18 22:34 UTC (permalink / raw)
  To: Alakesh Haloi
  Cc: stable, Greg Kroah-Hartman, Vlastimil Babka, Huang Ying,
	Sasha Levin, Sandeep Patil

On Thu, 18 Apr 2019 01:20:12 +0000 Alakesh Haloi <alakesh.haloi@gmail.com> wrote:

> This patch fixes the following uninitialized variable warning
> 
> fs/proc/task_mmu.c: In function 'show_smap.isra.33':
> fs/proc/task_mmu.c:761:7: warning: 'last_vma' may be used uninitialized in this function [-Wmaybe-uninitialized]
>   bool last_vma;
>        ^~~~~~~~

I can't immediately find a kernel tree to which this is applicable. 
What kernel are you patching?


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

* Re: [PATCH] fs/proc/task_mmu.c: fix uninitalized variable warning
  2019-04-18 22:34 ` Andrew Morton
@ 2019-04-25  0:34   ` Alakesh Haloi
  2019-04-25  6:47     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 6+ messages in thread
From: Alakesh Haloi @ 2019-04-25  0:34 UTC (permalink / raw)
  To: Andrew Morton
  Cc: stable, Greg Kroah-Hartman, Vlastimil Babka, Huang Ying,
	Sasha Levin, Sandeep Patil

On Thu, Apr 18, 2019 at 03:34:59PM -0700, Andrew Morton wrote:
> On Thu, 18 Apr 2019 01:20:12 +0000 Alakesh Haloi <alakesh.haloi@gmail.com> wrote:
> 
> > This patch fixes the following uninitialized variable warning
> > 
> > fs/proc/task_mmu.c: In function 'show_smap.isra.33':
> > fs/proc/task_mmu.c:761:7: warning: 'last_vma' may be used uninitialized in this function [-Wmaybe-uninitialized]
> >   bool last_vma;
> >        ^~~~~~~~
> 
> I can't immediately find a kernel tree to which this is applicable. 
> What kernel are you patching?
> 
This is for 4.14 stable tree. Corresponding commit does not exist in
mainline as the code has changed.

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

* Re: [PATCH] fs/proc/task_mmu.c: fix uninitalized variable warning
  2019-04-25  0:34   ` Alakesh Haloi
@ 2019-04-25  6:47     ` Greg Kroah-Hartman
  2019-04-27 15:06       ` Sasha Levin
  0 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2019-04-25  6:47 UTC (permalink / raw)
  To: Alakesh Haloi
  Cc: Andrew Morton, stable, Vlastimil Babka, Huang Ying, Sasha Levin,
	Sandeep Patil

On Thu, Apr 25, 2019 at 12:34:19AM +0000, Alakesh Haloi wrote:
> On Thu, Apr 18, 2019 at 03:34:59PM -0700, Andrew Morton wrote:
> > On Thu, 18 Apr 2019 01:20:12 +0000 Alakesh Haloi <alakesh.haloi@gmail.com> wrote:
> > 
> > > This patch fixes the following uninitialized variable warning
> > > 
> > > fs/proc/task_mmu.c: In function 'show_smap.isra.33':
> > > fs/proc/task_mmu.c:761:7: warning: 'last_vma' may be used uninitialized in this function [-Wmaybe-uninitialized]
> > >   bool last_vma;
> > >        ^~~~~~~~
> > 
> > I can't immediately find a kernel tree to which this is applicable. 
> > What kernel are you patching?
> > 
> This is for 4.14 stable tree. Corresponding commit does not exist in
> mainline as the code has changed.

I suggest updating your compiler to a sane one, I do not see this
warning at all in the 4.14.y tree.

thanks,

greg k-h

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

* Re: [PATCH] fs/proc/task_mmu.c: fix uninitalized variable warning
  2019-04-25  6:47     ` Greg Kroah-Hartman
@ 2019-04-27 15:06       ` Sasha Levin
  0 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2019-04-27 15:06 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Alakesh Haloi, Andrew Morton, stable, Vlastimil Babka,
	Huang Ying, Sasha Levin, Sandeep Patil

On Thu, Apr 25, 2019 at 08:47:41AM +0200, Greg Kroah-Hartman wrote:
>On Thu, Apr 25, 2019 at 12:34:19AM +0000, Alakesh Haloi wrote:
>> On Thu, Apr 18, 2019 at 03:34:59PM -0700, Andrew Morton wrote:
>> > On Thu, 18 Apr 2019 01:20:12 +0000 Alakesh Haloi <alakesh.haloi@gmail.com> wrote:
>> >
>> > > This patch fixes the following uninitialized variable warning
>> > >
>> > > fs/proc/task_mmu.c: In function 'show_smap.isra.33':
>> > > fs/proc/task_mmu.c:761:7: warning: 'last_vma' may be used uninitialized in this function [-Wmaybe-uninitialized]
>> > >   bool last_vma;
>> > >        ^~~~~~~~
>> >
>> > I can't immediately find a kernel tree to which this is applicable.
>> > What kernel are you patching?
>> >
>> This is for 4.14 stable tree. Corresponding commit does not exist in
>> mainline as the code has changed.
>
>I suggest updating your compiler to a sane one, I do not see this
>warning at all in the 4.14.y tree.

I've reproduced this warning using gcc 7.3, it looks like gcc 8.2 is
smart enough to understand that this is not actually an issue.

It was "fixed" upstream with 258f669e7e88 ("mm: /proc/pid/smaps_rollup:
convert to single value seq_file") which rewrote most of the code in
that area.

Given that this is a harmless warning that isn't seen with newer
compilers, I don't think it makes sense to do anything about it. I
figured I'd send this mail out just to have a record of this issue in
case it comes up again in the future.

--
Thanks,
Sasha

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

end of thread, other threads:[~2019-04-27 15:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-18  1:20 [PATCH] fs/proc/task_mmu.c: fix uninitalized variable warning Alakesh Haloi
2019-04-18  6:56 ` Greg Kroah-Hartman
2019-04-18 22:34 ` Andrew Morton
2019-04-25  0:34   ` Alakesh Haloi
2019-04-25  6:47     ` Greg Kroah-Hartman
2019-04-27 15:06       ` Sasha Levin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.