Skip to contentSkip to conversation

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

PATCH In review Stephen Rothwell 3 participants 3 messages Apr 6, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

Signature · 2 lines
Cheers,
Stephen Rothwell
maintainer
#1 lore raw

PATCH 1/1 mm: memcg: make sure memory.events is uptodate when waking pollers fix

Quoted 5 lines · Stephen Rothwell

Hi Andrew,

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

Quoted 8 lines

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.

---

mm/memcontrol.c +1 -2
index 04ea2b104ee2..9bac6dc26e09 100644
@@ -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;
 }
maintainer
#2 lore raw

Re: [patch] mm: memcg: make sure memory.events is uptodate when waking pollers fix

Quoted 25 lines · Johannes Weiner
Quoted 5 lines · Stephen Rothwell

Hi Andrew,

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

Quoted 8 lines

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.

---

mm/memcontrol.c +0 -0
index 04ea2b104ee2..9bac6dc26e09 100644

mm/memcontrol.c static int memory_events_show(struct seq_file *m, void *v) · line 5202

Quoted 6 lines
mm/memcontrol.c +1 -2
@@ -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.

Signature · 2 lines
Michal Hocko
SUSE Labs