linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: build warning after merge of the akpm-current tree
@ 2018-04-06  4:53 Stephen Rothwell
  2018-04-06 15:54 ` [patch] mm: memcg: make sure memory.events is uptodate when waking pollers fix Johannes Weiner
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Rothwell @ 2018-04-06  4:53 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Linux-Next Mailing List, Linux Kernel Mailing List, Johannes Weiner

[-- Attachment #1: Type: text/plain, Size: 529 bytes --]

Hi Andrew,

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

mm/memcontrol.c: In function 'memory_events_show':
mm/memcontrol.c:5453:23: warning: array subscript is above array bounds [-Warray-bounds]
      atomic_long_read(&memcg->memory_events[OOM_KILL]));
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Introduced by commit

  725844c87a0d ("mm: memcg: make sure memory.events is uptodate when waking pollers")

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* [patch] mm: memcg: make sure memory.events is uptodate when waking pollers fix
  2018-04-06  4:53 linux-next: build warning after merge of the akpm-current tree Stephen Rothwell
@ 2018-04-06 15:54 ` Johannes Weiner
  2018-04-06 16:11   ` Michal Hocko
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Weiner @ 2018-04-06 15:54 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Andrew Morton, Linux-Next Mailing List, Linux Kernel Mailing List

On Fri, Apr 06, 2018 at 02:53:30PM +1000, Stephen Rothwell wrote:
> Hi Andrew,
> 
> After merging the akpm-current tree, today's linux-next build (x86_64
> allmodconfig) produced this warning:
> 
> mm/memcontrol.c: In function 'memory_events_show':
> mm/memcontrol.c:5453:23: warning: array subscript is above array bounds [-Warray-bounds]
>       atomic_long_read(&memcg->memory_events[OOM_KILL]));
>                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Introduced by commit
> 
>   725844c87a0d ("mm: memcg: make sure memory.events is uptodate when waking pollers")

Ah, silly, I missed that warning. The below fixes it.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 04ea2b104ee2..9bac6dc26e09 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5199,8 +5199,7 @@ static int memory_events_show(struct seq_file *m, void *v)
 		   atomic_long_read(&memcg->memory_events[MEMCG_MAX]));
 	seq_printf(m, "oom %lu\n",
 		   atomic_long_read(&memcg->memory_events[MEMCG_OOM]));
-	seq_printf(m, "oom_kill %lu\n",
-		   atomic_long_read(&memcg->memory_events[OOM_KILL]));
+	seq_printf(m, "oom_kill %lu\n", memcg_sum_events(memcg, OOM_KILL));
 
 	return 0;
 }

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

* Re: [patch] mm: memcg: make sure memory.events is uptodate when waking pollers fix
  2018-04-06 15:54 ` [patch] mm: memcg: make sure memory.events is uptodate when waking pollers fix Johannes Weiner
@ 2018-04-06 16:11   ` Michal Hocko
  0 siblings, 0 replies; 3+ messages in thread
From: Michal Hocko @ 2018-04-06 16:11 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: Stephen Rothwell, Andrew Morton, Linux-Next Mailing List,
	Linux Kernel Mailing List

On Fri 06-04-18 11:54:41, Johannes Weiner wrote:
> On Fri, Apr 06, 2018 at 02:53:30PM +1000, Stephen Rothwell wrote:
> > Hi Andrew,
> > 
> > After merging the akpm-current tree, today's linux-next build (x86_64
> > allmodconfig) produced this warning:
> > 
> > mm/memcontrol.c: In function 'memory_events_show':
> > mm/memcontrol.c:5453:23: warning: array subscript is above array bounds [-Warray-bounds]
> >       atomic_long_read(&memcg->memory_events[OOM_KILL]));
> >                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > 
> > Introduced by commit
> > 
> >   725844c87a0d ("mm: memcg: make sure memory.events is uptodate when waking pollers")
> 
> Ah, silly, I missed that warning. The below fixes it.
> 
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> ---
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 04ea2b104ee2..9bac6dc26e09 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -5199,8 +5199,7 @@ static int memory_events_show(struct seq_file *m, void *v)
>  		   atomic_long_read(&memcg->memory_events[MEMCG_MAX]));
>  	seq_printf(m, "oom %lu\n",
>  		   atomic_long_read(&memcg->memory_events[MEMCG_OOM]));
> -	seq_printf(m, "oom_kill %lu\n",
> -		   atomic_long_read(&memcg->memory_events[OOM_KILL]));
> +	seq_printf(m, "oom_kill %lu\n", memcg_sum_events(memcg, OOM_KILL));

Ohh, this is so easy to miss.

-- 
Michal Hocko
SUSE Labs

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

end of thread, other threads:[~2018-04-06 16:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-06  4:53 linux-next: build warning after merge of the akpm-current tree Stephen Rothwell
2018-04-06 15:54 ` [patch] mm: memcg: make sure memory.events is uptodate when waking pollers fix Johannes Weiner
2018-04-06 16:11   ` Michal Hocko

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