ACPI/APEI: Limit printable size of BERT table data
[platform/kernel/linux-rpi.git] / drivers / acpi / apei / bert.c
index 8621142..598fd19 100644 (file)
@@ -29,6 +29,7 @@
 
 #undef pr_fmt
 #define pr_fmt(fmt) "BERT: " fmt
+#define ACPI_BERT_PRINT_MAX_LEN 1024
 
 static int bert_disable;
 
@@ -58,8 +59,11 @@ static void __init bert_print_all(struct acpi_bert_region *region,
                }
 
                pr_info_once("Error records from previous boot:\n");
-
-               cper_estatus_print(KERN_INFO HW_ERR, estatus);
+               if (region_len < ACPI_BERT_PRINT_MAX_LEN)
+                       cper_estatus_print(KERN_INFO HW_ERR, estatus);
+               else
+                       pr_info_once("Max print length exceeded, table data is available at:\n"
+                                    "/sys/firmware/acpi/tables/data/BERT");
 
                /*
                 * Because the boot error source is "one-time polled" type,