From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752943AbcEJOyx (ORCPT ); Tue, 10 May 2016 10:54:53 -0400 Received: from foss.arm.com ([217.140.101.70]:45728 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751136AbcEJOyw (ORCPT ); Tue, 10 May 2016 10:54:52 -0400 Date: Tue, 10 May 2016 15:54:41 +0100 From: Mark Rutland To: Julien Grall Cc: linux-arm-kernel@lists.infradead.org, will.deacon@arm.com, linux-kernel@vger.kernel.org, catalin.marinas@arm.com, stable@vger.kernel.org, "Suzuki K. Poulose" Subject: Re: [PATCH] arm64: cpuinfo: Missing NULL terminator in compat_hwcap_str Message-ID: <20160510145441.GC10785@leverpostej> References: <1462891231-17605-1-git-send-email-julien.grall@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1462891231-17605-1-git-send-email-julien.grall@arm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 10, 2016 at 03:40:31PM +0100, Julien Grall wrote: > The loop that browses the array compat_hwcap_str will stop when a NULL > is encountered, however NULL is missing at the end of array. This will > result to overrun until one NULL is found somewhere in the memory. Probably worth adding something like: Note for backporting: commit 12d11817eaafa414 ("arm64: Move /proc/cpuinfo handling code") moved this code. Prior to that commit, the same change should be made in arch/arm64/kernel/setup.c. > Fixes: 44b82b7700d0 "arm64: Fix up /proc/cpuinfo" > Signed-off-by: Julien Grall > Cc: stable@vger.kernel.org > > --- > > Cc: Mark Rutland > Cc: Suzuki K. Poulose > --- Wierd middle '---' between the Cc lines above. Otherwise: Reviewed-by: Mark Rutland Thanks for fixing this, sorry for introducing it in the first place! Mark. > arch/arm64/kernel/cpuinfo.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c > index 84c8684..f0c3fb7 100644 > --- a/arch/arm64/kernel/cpuinfo.c > +++ b/arch/arm64/kernel/cpuinfo.c > @@ -87,7 +87,8 @@ static const char *const compat_hwcap_str[] = { > "idivt", > "vfpd32", > "lpae", > - "evtstrm" > + "evtstrm", > + NULL > }; > > static const char *const compat_hwcap2_str[] = { > -- > 1.9.1 >