qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH 7/7] acpi: fix bug in acpi_checksum() caused


From: Richard Henderson
Subject: Re: [Qemu-devel] [RFC PATCH 7/7] acpi: fix bug in acpi_checksum() caused by garbage in checksum field
Date: Tue, 30 Mar 2010 08:10:52 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Thunderbird/3.0.3

On 03/30/2010 01:20 AM, Eduard - Gabriel Munteanu wrote:
> +    /* Ignore preexisting garbage in checksum. */
> +    acpi_hdr = (struct acpi_table_header *) data;
> +    sum -= acpi_hdr->checksum;
> +
>      return (-sum) & 0xff;

Wouldn't it be cleaner to adjust the acpi_checksum definition to take
and acpi_table_header operand instead of uint8_t?  And given it's only
usage, perhaps update the checksum instead of returning it?  E.g.

-    ((struct acpi_table_header*)p)->checksum = acpi_checksum((uint8_t*)p, off);
+    acpi_update_checksum((struct acpi_table_header *)p, off);


r~




reply via email to

[Prev in Thread] Current Thread [Next in Thread]