lkml.org 
[lkml]   [2018]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] x86/microcode/AMD: fix read of uninitialized data
Date
From: Colin Ian King <colin.king@canonical.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@canonical.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
\
 
 \ /
  Last update: 2018-04-10 15:43    [W:0.059 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site