[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181104135417.88671-1-sashal@kernel.org>
Date: Sun, 4 Nov 2018 08:54:03 -0500
From: Sasha Levin <sashal@...nel.org>
To: stable@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Jann Horn <jannh@...gle.com>, Davidlohr Bueso <dave@...olabs.net>,
Oleg Nesterov <oleg@...hat.com>,
Christoph Lameter <clameter@....com>,
Kemi Wang <kemi.wang@...el.com>,
Andy Lutomirski <luto@...nel.org>,
Ingo Molnar <mingo@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Sasha Levin <sashal@...nel.org>
Subject: [PATCH AUTOSEL 4.4 01/15] mm/vmstat.c: assert that vmstat_text is in sync with stat_items_size
From: Jann Horn <jannh@...gle.com>
[ Upstream commit f0ecf25a093fc0589f0a6bc4c1ea068bbb67d220 ]
Having two gigantic arrays that must manually be kept in sync, including
ifdefs, isn't exactly robust. To make it easier to catch such issues in
the future, add a BUILD_BUG_ON().
Link: http://lkml.kernel.org/r/20181001143138.95119-3-jannh@google.com
Signed-off-by: Jann Horn <jannh@...gle.com>
Reviewed-by: Kees Cook <keescook@...omium.org>
Reviewed-by: Andrew Morton <akpm@...ux-foundation.org>
Acked-by: Roman Gushchin <guro@...com>
Acked-by: Michal Hocko <mhocko@...e.com>
Cc: Davidlohr Bueso <dave@...olabs.net>
Cc: Oleg Nesterov <oleg@...hat.com>
Cc: Christoph Lameter <clameter@....com>
Cc: Kemi Wang <kemi.wang@...el.com>
Cc: Andy Lutomirski <luto@...nel.org>
Cc: Ingo Molnar <mingo@...nel.org>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
mm/vmstat.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/vmstat.c b/mm/vmstat.c
index a2d70ef74db7..a32a92c0f218 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1320,6 +1320,8 @@ static void *vmstat_start(struct seq_file *m, loff_t *pos)
stat_items_size += sizeof(struct vm_event_state);
#endif
+ BUILD_BUG_ON(stat_items_size !=
+ ARRAY_SIZE(vmstat_text) * sizeof(unsigned long));
v = kmalloc(stat_items_size, GFP_KERNEL);
m->private = v;
if (!v)
--
2.17.1
Powered by blists - more mailing lists