diff options
| -rw-r--r-- | drivers/acpi/apei/bert.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/acpi/apei/bert.c b/drivers/acpi/apei/bert.c index 12771fcf0417..0d948d0a41af 100644 --- a/drivers/acpi/apei/bert.c +++ b/drivers/acpi/apei/bert.c | |||
| @@ -42,15 +42,7 @@ static void __init bert_print_all(struct acpi_bert_region *region, | |||
| 42 | int remain = region_len; | 42 | int remain = region_len; |
| 43 | u32 estatus_len; | 43 | u32 estatus_len; |
| 44 | 44 | ||
| 45 | if (!estatus->block_status) | 45 | while (remain >= sizeof(struct acpi_bert_region)) { |
| 46 | return; | ||
| 47 | |||
| 48 | while (remain > sizeof(struct acpi_bert_region)) { | ||
| 49 | if (cper_estatus_check(estatus)) { | ||
| 50 | pr_err(FW_BUG "Invalid error record.\n"); | ||
| 51 | return; | ||
| 52 | } | ||
| 53 | |||
| 54 | estatus_len = cper_estatus_len(estatus); | 46 | estatus_len = cper_estatus_len(estatus); |
| 55 | if (remain < estatus_len) { | 47 | if (remain < estatus_len) { |
| 56 | pr_err(FW_BUG "Truncated status block (length: %u).\n", | 48 | pr_err(FW_BUG "Truncated status block (length: %u).\n", |
| @@ -58,6 +50,15 @@ static void __init bert_print_all(struct acpi_bert_region *region, | |||
| 58 | return; | 50 | return; |
| 59 | } | 51 | } |
| 60 | 52 | ||
| 53 | /* No more error records. */ | ||
| 54 | if (!estatus->block_status) | ||
| 55 | return; | ||
| 56 | |||
| 57 | if (cper_estatus_check(estatus)) { | ||
| 58 | pr_err(FW_BUG "Invalid error record.\n"); | ||
| 59 | return; | ||
| 60 | } | ||
| 61 | |||
| 61 | pr_info_once("Error records from previous boot:\n"); | 62 | pr_info_once("Error records from previous boot:\n"); |
| 62 | 63 | ||
| 63 | cper_estatus_print(KERN_INFO HW_ERR, estatus); | 64 | cper_estatus_print(KERN_INFO HW_ERR, estatus); |
| @@ -70,10 +71,6 @@ static void __init bert_print_all(struct acpi_bert_region *region, | |||
| 70 | estatus->block_status = 0; | 71 | estatus->block_status = 0; |
| 71 | 72 | ||
| 72 | estatus = (void *)estatus + estatus_len; | 73 | estatus = (void *)estatus + estatus_len; |
| 73 | /* No more error records. */ | ||
| 74 | if (!estatus->block_status) | ||
| 75 | return; | ||
| 76 | |||
| 77 | remain -= estatus_len; | 74 | remain -= estatus_len; |
| 78 | } | 75 | } |
| 79 | } | 76 | } |
