Commit 44f47d94 authored by Julien Grall's avatar Julien Grall Committed by Greg Kroah-Hartman

arm64: cpuinfo: Missing NULL terminator in compat_hwcap_str

commit f228b494 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 12d11817 ("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: 44b82b77 "arm64: Fix up /proc/cpuinfo"
Signed-off-by: default avatarJulien Grall <julien.grall@arm.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7e1c1db0
...@@ -85,7 +85,8 @@ static const char *const compat_hwcap_str[] = { ...@@ -85,7 +85,8 @@ static const char *const compat_hwcap_str[] = {
"idivt", "idivt",
"vfpd32", "vfpd32",
"lpae", "lpae",
"evtstrm" "evtstrm",
NULL
}; };
static const char *const compat_hwcap2_str[] = { static const char *const compat_hwcap2_str[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment