From: Tejun Heo <tj@kernel.org>
Date: Fri, 3 Jul 2009 23:10:58 +0000 (+0900)
Subject: x86: make pcpu_chunk_addr_search() matching stricter
X-Git-Tag: firefly_0821_release~12956^2^2~34
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=79ba6ac825fac187894e236c9df1ba5fcbf53fd3;p=firefly-linux-kernel-4.4.55.git

x86: make pcpu_chunk_addr_search() matching stricter

The @addr passed into pcpu_chunk_addr_search() is unit0 based address
and thus should be matched inside unit0 area.  Currently, when it uses
chunk size when determining whether the address falls in the first
chunk.  Addresses in unitN where N>0 shouldn't be passed in anyway, so
this doesn't cause any malfunction but fix it for consistency.

[ Impact: mostly cleanup ]

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>
---

diff --git a/mm/percpu.c b/mm/percpu.c
index b14984566f5a..19dd83b5cbdc 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -290,7 +290,7 @@ static struct pcpu_chunk *pcpu_chunk_addr_search(void *addr)
 	void *first_start = pcpu_first_chunk->vm->addr;
 
 	/* is it in the first chunk? */
-	if (addr >= first_start && addr < first_start + pcpu_chunk_size) {
+	if (addr >= first_start && addr < first_start + pcpu_unit_size) {
 		/* is it in the reserved area? */
 		if (addr < first_start + pcpu_reserved_chunk_limit)
 			return pcpu_reserved_chunk;