[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 7/7] acpi: fix bug in acpi_checksum() caused by
From: |
Eduard - Gabriel Munteanu |
Subject: |
[Qemu-devel] [RFC PATCH 7/7] acpi: fix bug in acpi_checksum() caused by garbage in checksum field |
Date: |
Tue, 30 Mar 2010 11:20:08 +0300 |
The whole table must sum to zero. We need to ignore garbage in the
checksum field (i.e. consider it zero) when checksumming. It is
legitimate to have garbage there, as the checksum makes sense only when
the table has been filled.
Signed-off-by: Eduard - Gabriel Munteanu <address@hidden>
---
hw/acpi.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/hw/acpi.c b/hw/acpi.c
index f067f85..bb015f3 100644
--- a/hw/acpi.c
+++ b/hw/acpi.c
@@ -832,11 +832,16 @@ size_t acpi_tables_len, acpi_tables_prev_len;
static int acpi_checksum(const uint8_t *data, int len)
{
int sum, i;
+ struct acpi_table_header *acpi_hdr;
sum = 0;
for(i = 0; i < len; i++)
sum += data[i];
+ /* Ignore preexisting garbage in checksum. */
+ acpi_hdr = (struct acpi_table_header *) data;
+ sum -= acpi_hdr->checksum;
+
return (-sum) & 0xff;
}
--
1.6.4.4
- [Qemu-devel] [RFC PATCH 0/7] Beginning implementing the AMD IOMMU emulation, Eduard - Gabriel Munteanu, 2010/03/30
- [Qemu-devel] [RFC PATCH 2/7] acpi: split and rename acpi_table_add(), Eduard - Gabriel Munteanu, 2010/03/30
- [Qemu-devel] [RFC PATCH 1/7] acpi: qemu_realloc() might return a different pointer, Eduard - Gabriel Munteanu, 2010/03/30
- [Qemu-devel] [RFC PATCH 7/7] acpi: fix bug in acpi_checksum() caused by garbage in checksum field,
Eduard - Gabriel Munteanu <=
- [Qemu-devel] [RFC PATCH 3/7] acpi: move table header definition into pc.h, Eduard - Gabriel Munteanu, 2010/03/30
- [Qemu-devel] [RFC PATCH 4/7] sparc: rename hw/iommu.c, Eduard - Gabriel Munteanu, 2010/03/30
- Re: [Qemu-devel] [RFC PATCH 4/7] sparc: rename hw/iommu.c, Gerd Hoffmann, 2010/03/31
[Qemu-devel] [RFC PATCH 5/7] x86-64: AMD IOMMU stub, Eduard - Gabriel Munteanu, 2010/03/30