'len' is the length of just the ACPI data, not the length of the whole acpi_tables data (that has a QEMU-specific prefix), so rename it to make it more clear.
No behavior change, just a variable rename. Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> --- hw/acpi.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/acpi.c b/hw/acpi.c index 6180c7a..abc959e 100644 --- a/hw/acpi.c +++ b/hw/acpi.c @@ -86,7 +86,7 @@ int acpi_table_add(const char *t) { char buf[1024], *p, *f; unsigned long val; - size_t len, start, allen; + size_t acpi_len, start, allen; bool has_header; int changed; int r; @@ -156,9 +156,9 @@ int acpi_table_add(const char *t) memcpy(&hdr, has_header ? f : dfl_hdr, ACPI_TABLE_HDR_SIZE); /* length of the table minus our prefix */ - len = allen - start - ACPI_TABLE_PFX_SIZE; + acpi_len = allen - start - ACPI_TABLE_PFX_SIZE; - hdr._length = cpu_to_le16(len); + hdr._length = cpu_to_le16(acpi_len); if (get_param_value(buf, sizeof(buf), "sig", t)) { strzcpy(hdr.sig, buf, sizeof(hdr.sig)); @@ -169,16 +169,16 @@ int acpi_table_add(const char *t) if (has_header) { /* check if actual length is correct */ val = le32_to_cpu(hdr.length); - if (val != len) { + if (val != acpi_len) { fprintf(stderr, "warning: acpitable has wrong length," " header says %lu, actual size %zu bytes\n", - val, len); + val, acpi_len); ++changed; } } /* we may avoid putting length here if has_header is true */ - hdr.length = cpu_to_le32(len); + hdr.length = cpu_to_le32(acpi_len); if (get_param_value(buf, sizeof(buf), "rev", t)) { val = strtoul(buf, &p, 0); @@ -241,7 +241,7 @@ int acpi_table_add(const char *t) if (changed || !has_header || 1) { ((struct acpi_table_header *)f)->checksum = - acpi_checksum((uint8_t *)f + ACPI_TABLE_PFX_SIZE, len); + acpi_checksum((uint8_t *)f + ACPI_TABLE_PFX_SIZE, acpi_len); } /* increase number of tables */ -- 1.7.10.4