linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: cpuinfo: Missing NULL terminator in compat_hwcap_str
@ 2016-05-10 14:40 Julien Grall
  2016-05-10 14:54 ` Mark Rutland
  0 siblings, 1 reply; 4+ messages in thread
From: Julien Grall @ 2016-05-10 14:40 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: will.deacon, linux-kernel, julien.grall, catalin.marinas, stable,
	Mark Rutland, Suzuki K. Poulose

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.

Fixes: 44b82b7700d0 "arm64: Fix up /proc/cpuinfo"
Signed-off-by: Julien Grall <julien.grall@arm.com>
Cc: stable@vger.kernel.org

---

Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Suzuki K. Poulose <suzuki.poulose@arm.com>
---
 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] arm64: cpuinfo: Missing NULL terminator in compat_hwcap_str
  2016-05-10 14:40 [PATCH] arm64: cpuinfo: Missing NULL terminator in compat_hwcap_str Julien Grall
@ 2016-05-10 14:54 ` Mark Rutland
  2016-05-11  9:38   ` Julien Grall
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Rutland @ 2016-05-10 14:54 UTC (permalink / raw)
  To: Julien Grall
  Cc: linux-arm-kernel, will.deacon, linux-kernel, catalin.marinas,
	stable, Suzuki K. Poulose

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 <julien.grall@arm.com>
> Cc: stable@vger.kernel.org
> 
> ---
> 
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Suzuki K. Poulose <suzuki.poulose@arm.com>
> ---

Wierd middle '---' between the Cc lines above.

Otherwise:

Reviewed-by: Mark Rutland <mark.rutland@arm.com>

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
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] arm64: cpuinfo: Missing NULL terminator in compat_hwcap_str
  2016-05-10 14:54 ` Mark Rutland
@ 2016-05-11  9:38   ` Julien Grall
  2016-05-11  9:40     ` Will Deacon
  0 siblings, 1 reply; 4+ messages in thread
From: Julien Grall @ 2016-05-11  9:38 UTC (permalink / raw)
  To: Mark Rutland
  Cc: linux-arm-kernel, will.deacon, linux-kernel, catalin.marinas,
	stable, Suzuki K. Poulose

Hi Mark,

On 10/05/2016 15:54, Mark Rutland wrote:
> 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.

I can resend the patch with this changes.

>
>> Fixes: 44b82b7700d0 "arm64: Fix up /proc/cpuinfo"
>> Signed-off-by: Julien Grall <julien.grall@arm.com>
>> Cc: stable@vger.kernel.org
>>
>> ---
>>
>> Cc: Mark Rutland <mark.rutland@arm.com>
>> Cc: Suzuki K. Poulose <suzuki.poulose@arm.com>
>> ---
>
> Wierd middle '---' between the Cc lines above.

It is an habit I have with Xen-devel as the Cc are not necessary after 
it has been committed.

>
> Otherwise:
>
> Reviewed-by: Mark Rutland <mark.rutland@arm.com>

Thank you!

Regards,

-- 
Julien Grall

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] arm64: cpuinfo: Missing NULL terminator in compat_hwcap_str
  2016-05-11  9:38   ` Julien Grall
@ 2016-05-11  9:40     ` Will Deacon
  0 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2016-05-11  9:40 UTC (permalink / raw)
  To: Julien Grall
  Cc: Mark Rutland, linux-arm-kernel, linux-kernel, catalin.marinas,
	stable, Suzuki K. Poulose

On Wed, May 11, 2016 at 10:38:36AM +0100, Julien Grall wrote:
> Hi Mark,
> 
> On 10/05/2016 15:54, Mark Rutland wrote:
> >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.
> 
> I can resend the patch with this changes.

No need, I've already applied it locally with Mark's suggestions.

Will

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-05-11  9:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-10 14:40 [PATCH] arm64: cpuinfo: Missing NULL terminator in compat_hwcap_str Julien Grall
2016-05-10 14:54 ` Mark Rutland
2016-05-11  9:38   ` Julien Grall
2016-05-11  9:40     ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).