From: Tejun Heo <tj@kernel.org>
Date: Thu, 24 Sep 2009 09:50:34 +0000 (+0900)
Subject: percpu: make pcpu_build_alloc_info() clear static buffers
X-Git-Tag: firefly_0821_release~11893^2~8
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fb59e72e7e10fd9d31f4e522f1b28254c2cc8a6c;p=firefly-linux-kernel-4.4.55.git

percpu: make pcpu_build_alloc_info() clear static buffers

pcpu_build_alloc_info() may be called multiple times when percpu is
falling back to different first chunk allocator.  Make it clear static
buffers so that they don't contain values from previous runs.

Signed-off-by: Tejun Heo <tj@kernel.org>
---

diff --git a/mm/percpu.c b/mm/percpu.c
index e5c4cbda6026..a64133f8af45 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1347,6 +1347,10 @@ struct pcpu_alloc_info * __init pcpu_build_alloc_info(
 	struct pcpu_alloc_info *ai;
 	unsigned int *cpu_map;
 
+	/* this function may be called multiple times */
+	memset(group_map, 0, sizeof(group_map));
+	memset(group_cnt, 0, sizeof(group_map));
+
 	/*
 	 * Determine min_unit_size, alloc_size and max_upa such that
 	 * alloc_size is multiple of atom_size and is the smallest