[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 1/7] ACPI: Assert that we don't run out of the preallocated memory
From: |
Peter Maydell |
Subject: |
[PULL 1/7] ACPI: Assert that we don't run out of the preallocated memory |
Date: |
Mon, 27 Jul 2020 16:19:14 +0100 |
From: Dongjiu Geng <gengdongjiu@huawei.com>
data_length is a constant value, so we use assert instead of
condition check.
Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
Message-id: 20200622113146.33421-1-gengdongjiu@huawei.com
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/acpi/ghes.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c
index b363bc331d0..f0ee9f51caa 100644
--- a/hw/acpi/ghes.c
+++ b/hw/acpi/ghes.c
@@ -204,16 +204,12 @@ static int acpi_ghes_record_mem_error(uint64_t
error_block_address,
/* This is the length if adding a new generic error data entry*/
data_length = ACPI_GHES_DATA_LENGTH + ACPI_GHES_MEM_CPER_LENGTH;
-
/*
- * Check whether it will run out of the preallocated memory if adding a new
- * generic error data entry
+ * It should not run out of the preallocated memory if adding a new generic
+ * error data entry
*/
- if ((data_length + ACPI_GHES_GESB_SIZE) > ACPI_GHES_MAX_RAW_DATA_LENGTH) {
- error_report("Not enough memory to record new CPER!!!");
- g_array_free(block, true);
- return -1;
- }
+ assert((data_length + ACPI_GHES_GESB_SIZE) <=
+ ACPI_GHES_MAX_RAW_DATA_LENGTH);
/* Build the new generic error status block header */
acpi_ghes_generic_error_status(block, ACPI_GEBS_UNCORRECTABLE,
--
2.20.1
- [PULL 0/7] target-arm queue, Peter Maydell, 2020/07/27
- [PULL 2/7] hw/misc/aspeed_sdmc: Fix incorrect memory size, Peter Maydell, 2020/07/27
- [PULL 3/7] target/arm: Always pass cacheattr in S1_ptw_translate, Peter Maydell, 2020/07/27
- [PULL 1/7] ACPI: Assert that we don't run out of the preallocated memory,
Peter Maydell <=
- [PULL 4/7] docs/system/arm/virt: Document 'mte' machine option, Peter Maydell, 2020/07/27
- [PULL 5/7] hw/arm/boot: Fix PAUTH for EL3 direct kernel boot, Peter Maydell, 2020/07/27
- [PULL 6/7] hw/arm/boot: Fix MTE for EL3 direct kernel boot, Peter Maydell, 2020/07/27
- [PULL 7/7] target/arm: Improve IMPDEF algorithm for IRG, Peter Maydell, 2020/07/27
- Re: [PULL 0/7] target-arm queue, Peter Maydell, 2020/07/28