aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86_64/kernel/mce.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c
index a14375dd5425..aa1d15991794 100644
--- a/arch/x86_64/kernel/mce.c
+++ b/arch/x86_64/kernel/mce.c
@@ -497,15 +497,17 @@ static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize, loff
497 for (i = 0; i < next; i++) { 497 for (i = 0; i < next; i++) {
498 unsigned long start = jiffies; 498 unsigned long start = jiffies;
499 while (!mcelog.entry[i].finished) { 499 while (!mcelog.entry[i].finished) {
500 if (!time_before(jiffies, start + 2)) { 500 if (time_after_eq(jiffies, start + 2)) {
501 memset(mcelog.entry + i,0, sizeof(struct mce)); 501 memset(mcelog.entry + i,0, sizeof(struct mce));
502 continue; 502 goto timeout;
503 } 503 }
504 cpu_relax(); 504 cpu_relax();
505 } 505 }
506 smp_rmb(); 506 smp_rmb();
507 err |= copy_to_user(buf, mcelog.entry + i, sizeof(struct mce)); 507 err |= copy_to_user(buf, mcelog.entry + i, sizeof(struct mce));
508 buf += sizeof(struct mce); 508 buf += sizeof(struct mce);
509 timeout:
510 ;
509 } 511 }
510 512
511 memset(mcelog.entry, 0, next * sizeof(struct mce)); 513 memset(mcelog.entry, 0, next * sizeof(struct mce));