edac, mce: Filter out invalid values
authorBorislav Petkov <borislav.petkov@amd.com>
Tue, 9 Mar 2010 19:38:48 +0000 (20:38 +0100)
committerBorislav Petkov <borislav.petkov@amd.com>
Mon, 22 Mar 2010 15:33:31 +0000 (16:33 +0100)
Print the CPU associated with the error only when the field is valid.

Cc: <stable@kernel.org> # .32.x .33.x
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
drivers/edac/edac_mce_amd.c

index 8fc91a0..f5b6d9f 100644 (file)
@@ -316,7 +316,12 @@ void amd_decode_nb_mce(int node_id, struct err_regs *regs, int handle_errors)
                if (regs->nbsh & K8_NBSH_ERR_CPU_VAL)
                        pr_cont(", core: %u\n", (u8)(regs->nbsh & 0xf));
        } else {
-               pr_cont(", core: %d\n", fls((regs->nbsh & 0xf) - 1));
+               u8 assoc_cpus = regs->nbsh & 0xf;
+
+               if (assoc_cpus > 0)
+                       pr_cont(", core: %d", fls(assoc_cpus) - 1);
+
+               pr_cont("\n");
        }
 
        pr_emerg("%s.\n", EXT_ERR_MSG(xec));