summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Grall <julien.grall@arm.com>2016-05-10 15:40:31 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-06-01 12:17:57 -0700
commitebe381c0a4ab69f88b502b3dfd3d489202cd0073 (patch)
treea9d8a4eaace689625642b3fe97837760880e6169
parentb987714532522c6507e1b01a0ffdbf5649fdd64a (diff)
downloadlwn-ebe381c0a4ab69f88b502b3dfd3d489202cd0073.tar.gz
lwn-ebe381c0a4ab69f88b502b3dfd3d489202cd0073.zip
arm64: cpuinfo: Missing NULL terminator in compat_hwcap_str
commit f228b494e56d949be8d8ea09d4f973d1979201bf upstream. 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 lead to overrun until a NULL is found somewhere in the following memory. In reality, this works out because the compat_hwcap2_str array tends to follow immediately in memory, and that *is* terminated correctly. Furthermore, the unsigned int compat_elf_hwcap is checked before printing each capability, so we end up doing the right thing because the size of the two arrays is less than 32. Still, this is an obvious mistake and should be fixed. Note for backporting: commit 12d11817eaafa414 ("arm64: Move /proc/cpuinfo handling code") moved this code in v4.4. 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> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--arch/arm64/kernel/cpuinfo.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
index 84c8684431c7..f0c3fb7ec8cf 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[] = {