mirror of https://gitee.com/openkylin/linux.git
x86/mce: Fix use of uninitialized MCE message string
The function mce_severity() is not required to update its msg argument. In fact, mce_severity_amd() does not, which makes mce_no_way_out() return uninitialized data, which may be used later for printing. Assuming that implementations of mce_severity() either always or never update the msg argument (which is currently the case), it is sufficient to initialize the temporary variable in mce_no_way_out(). While at it, avoid printing a useless "Unknown". Signed-off-by: Jan H. Schönherr <jschoenh@amazon.de> Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lkml.kernel.org/r/20200103150722.20313-4-jschoenh@amazon.de
This commit is contained in:
parent
90454e4959
commit
7a8bc2b046
|
@ -795,7 +795,7 @@ EXPORT_SYMBOL_GPL(machine_check_poll);
|
||||||
static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp,
|
static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp,
|
||||||
struct pt_regs *regs)
|
struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
char *tmp;
|
char *tmp = *msg;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < this_cpu_read(mce_num_banks); i++) {
|
for (i = 0; i < this_cpu_read(mce_num_banks); i++) {
|
||||||
|
@ -1220,8 +1220,8 @@ void do_machine_check(struct pt_regs *regs, long error_code)
|
||||||
DECLARE_BITMAP(toclear, MAX_NR_BANKS);
|
DECLARE_BITMAP(toclear, MAX_NR_BANKS);
|
||||||
struct mca_config *cfg = &mca_cfg;
|
struct mca_config *cfg = &mca_cfg;
|
||||||
int cpu = smp_processor_id();
|
int cpu = smp_processor_id();
|
||||||
char *msg = "Unknown";
|
|
||||||
struct mce m, *final;
|
struct mce m, *final;
|
||||||
|
char *msg = NULL;
|
||||||
int worst = 0;
|
int worst = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue