From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752807AbbDAJhx (ORCPT ); Wed, 1 Apr 2015 05:37:53 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:53645 "EHLO e39.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751113AbbDAJhg (ORCPT ); Wed, 1 Apr 2015 05:37:36 -0400 Message-ID: <551BBC49.707@linux.vnet.ibm.com> Date: Wed, 01 Apr 2015 15:07:13 +0530 From: Preeti U Murthy User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Jan Stancek , linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au CC: linux-kernel@vger.kernel.org, benh@kernel.crashing.org, paulus@samba.org, mikey@neuling.org, shreyas@linux.vnet.ibm.com, sbest@redhat.com Subject: Re: [PATCH] powerpc: fix memory corruption by pnv_alloc_idle_core_states References: <67174f780b3615749546d5a6d5bfba4c4f26a855.1427818011.git.jstancek@redhat.com> In-Reply-To: <67174f780b3615749546d5a6d5bfba4c4f26a855.1427818011.git.jstancek@redhat.com> Content-Type: text/plain; charset=ISO-8859-6 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15040109-0033-0000-0000-0000041B3BE1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/31/2015 09:41 PM, Jan Stancek wrote: > Space allocated for paca is based off nr_cpu_ids, > but pnv_alloc_idle_core_states() iterates paca with > cpu_nr_cores()*threads_per_core, which is using NR_CPUS. > > This causes pnv_alloc_idle_core_states() to write over memory, > which is outside of paca array and may later lead to various panics. > > Fixes: 7cba160ad789 (powernv/cpuidle: Redesign idle states management) > Signed-off-by: Jan Stancek > --- > arch/powerpc/include/asm/cputhreads.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/powerpc/include/asm/cputhreads.h b/arch/powerpc/include/asm/cputhreads.h > index 2bf8e93..4c8ad59 100644 > --- a/arch/powerpc/include/asm/cputhreads.h > +++ b/arch/powerpc/include/asm/cputhreads.h > @@ -55,7 +55,7 @@ static inline cpumask_t cpu_thread_mask_to_cores(const struct cpumask *threads) > > static inline int cpu_nr_cores(void) > { > - return NR_CPUS >> threads_shift; > + return nr_cpu_ids >> threads_shift; > } Thanks for the patch! Reviewed-by: Preeti U. Murthy > > static inline cpumask_t cpu_online_cores_map(void) >