[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180410134123.13832-1-colin.king@canonical.com>
Date: Tue, 10 Apr 2018 14:41:23 +0100
From: Colin King <colin.king@...onical.com>
To: Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H . Peter Anvin" <hpa@...or.com>, x86@...nel.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] x86/microcode/AMD: fix read of uninitialized data
From: Colin Ian King <colin.king@...onical.com>
Currently function __load_ucode_amd can assign an uninitialized cp to *ret
if get_builtin_microcode returns false. This could cause function
load_ucode_amd_bsp to attempt to apply the microcode if the garbage data in
cp is non-zero. Fix this by moving the zero'ing of cp from function
load_ucode_amd_bsp to __load_ucode_amd.
Detected by CoverityScan, CID#1398332 ("Uninitialized scalar variable")
Fixes: 69f5f983001f ("x86/microcode/AMD: Remove AP scanning optimization")
Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
arch/x86/kernel/cpu/microcode/amd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index 0624957aa068..745135699233 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -254,7 +254,7 @@ static bool get_builtin_microcode(struct cpio_data *cp, unsigned int family)
static void __load_ucode_amd(unsigned int cpuid_1_eax, struct cpio_data *ret)
{
struct ucode_cpu_info *uci;
- struct cpio_data cp;
+ struct cpio_data cp = { };
const char *path;
bool use_pa;
@@ -279,7 +279,7 @@ static void __load_ucode_amd(unsigned int cpuid_1_eax, struct cpio_data *ret)
void __init load_ucode_amd_bsp(unsigned int cpuid_1_eax)
{
- struct cpio_data cp = { };
+ struct cpio_data cp;
__load_ucode_amd(cpuid_1_eax, &cp);
if (!(cp.data && cp.size))
--
2.15.1
Powered by blists - more mailing lists