Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1407785 > unrolled thread

linux-next: build warning after merge of the akpm-current tree

Started byStephen Rothwell <sfr@canb.auug.org.au>
First post2016-05-27 05:10 +0200
Last post2016-05-27 22:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  linux-next: build warning after merge of the akpm-current tree Stephen Rothwell <sfr@canb.auug.org.au> - 2016-05-27 05:10 +0200
    Re: linux-next: build warning after merge of the akpm-current tree Andrew Morton <akpm@linux-foundation.org> - 2016-05-27 22:00 +0200

#1407785 — linux-next: build warning after merge of the akpm-current tree

FromStephen Rothwell <sfr@canb.auug.org.au>
Date2016-05-27 05:10 +0200
Subjectlinux-next: build warning after merge of the akpm-current tree
Message-ID<rDgjU-6rz-5@gated-at.bofh.it>
Hi Andrew,

After merging the akpm-current tree, today's linux-next build (arm
multi_v7_defconfig) produced this warning:

mm/oom_kill.c: In function '__oom_reap_task':
mm/oom_kill.c:537:2: warning: 'mm' may be used uninitialized in this function [-Wmaybe-uninitialized]
  mmput_async(mm);
  ^

Introduced by commit

  df1e2f56632d ("oom_reaper: close race with exiting task")

This is real - the first "goto unlock_oom" is before "mm" has been
assigned.

-- 
Cheers,
Stephen Rothwell

[toc] | [next] | [standalone]


#1408266

FromAndrew Morton <akpm@linux-foundation.org>
Date2016-05-27 22:00 +0200
Message-ID<rDw5k-7Db-9@gated-at.bofh.it>
In reply to#1407785
On Fri, 27 May 2016 13:07:10 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:

> Hi Andrew,
> 
> After merging the akpm-current tree, today's linux-next build (arm
> multi_v7_defconfig) produced this warning:
> 
> mm/oom_kill.c: In function '__oom_reap_task':
> mm/oom_kill.c:537:2: warning: 'mm' may be used uninitialized in this function [-Wmaybe-uninitialized]
>   mmput_async(mm);
>   ^
> 
> Introduced by commit
> 
>   df1e2f56632d ("oom_reaper: close race with exiting task")
> 
> This is real - the first "goto unlock_oom" is before "mm" has been
> assigned.

Yup, thanks.

From: Andrew Morton <akpm@linux-foundation.org>
Subject: oom_reaper-close-race-with-exiting-task-fix

fix use of unused `mm', Per Stephen

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/oom_kill.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff -puN mm/oom_kill.c~oom_reaper-close-race-with-exiting-task-fix mm/oom_kill.c
--- a/mm/oom_kill.c~oom_reaper-close-race-with-exiting-task-fix
+++ a/mm/oom_kill.c
@@ -443,7 +443,7 @@ static bool __oom_reap_task(struct task_
 {
 	struct mmu_gather tlb;
 	struct vm_area_struct *vma;
-	struct mm_struct *mm;
+	struct mm_struct *mm = NULL;
 	struct task_struct *p;
 	struct zap_details details = {.check_swap_entries = true,
 				      .ignore_dirty = true};
@@ -534,7 +534,8 @@ unlock_oom:
 	 * different context because we shouldn't risk we get stuck there and
 	 * put the oom_reaper out of the way.
 	 */
-	mmput_async(mm);
+	if (mm)
+		mmput_async(mm);
 	return ret;
 }
 
_

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web