From 2e036bd1e8e4b094cf31a2e744076ad6087acf48 Mon Sep 17 00:00:00 2001 From: Olof Johansson Date: Wed, 20 Oct 2004 20:57:03 -0700 Subject: [PATCH] [PATCH] ppc64: fix CPU numa init code thinkos There seems to have been a couple of thinkos in the NUMA init code, in particular in find_cpu_node(): * Property size returned is in bytes, not words * Off-by-one error in loop iteration Signed-off-by: Nathan Lynch Signed-off-by: Olof Johansson Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ppc64/mm/numa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/ppc64/mm/numa.c b/arch/ppc64/mm/numa.c index 43e8bc0849960..aef21479bbcdb 100644 --- a/arch/ppc64/mm/numa.c +++ b/arch/ppc64/mm/numa.c @@ -76,9 +76,11 @@ static struct device_node * __init find_cpu_node(unsigned int cpu) interrupt_server = (unsigned int *)get_property(cpu_node, "ibm,ppc-interrupt-server#s", &len); + len = len / sizeof(u32); + if (interrupt_server && (len > 0)) { while (len--) { - if (interrupt_server[len-1] == hw_cpuid) + if (interrupt_server[len] == hw_cpuid) return cpu_node; } } else { -- 2.53.0