Skip to content

Commit 7a8bc2b

Browse files
schnhrrsuryasaimadhu
authored andcommitted
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 <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 90454e4 commit 7a8bc2b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/x86/kernel/cpu/mce/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ EXPORT_SYMBOL_GPL(machine_check_poll);
795795
static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp,
796796
struct pt_regs *regs)
797797
{
798-
char *tmp;
798+
char *tmp = *msg;
799799
int i;
800800

801801
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)
12201220
DECLARE_BITMAP(toclear, MAX_NR_BANKS);
12211221
struct mca_config *cfg = &mca_cfg;
12221222
int cpu = smp_processor_id();
1223-
char *msg = "Unknown";
12241223
struct mce m, *final;
1224+
char *msg = NULL;
12251225
int worst = 0;
12261226

12271227
/*

0 commit comments

Comments
 (0)