From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34561) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UITOh-0001Y1-Kj for qemu-devel@nongnu.org; Wed, 20 Mar 2013 20:30:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UITOe-0007h5-Qm for qemu-devel@nongnu.org; Wed, 20 Mar 2013 20:30:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59588) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UITBU-0003jB-9M for qemu-devel@nongnu.org; Wed, 20 Mar 2013 20:16:44 -0400 Message-ID: <514A51EC.9050801@redhat.com> Date: Thu, 21 Mar 2013 01:18:52 +0100 From: Laszlo Ersek MIME-Version: 1.0 References: <1363821803-3380-1-git-send-email-lersek@redhat.com> <1363821803-3380-3-git-send-email-lersek@redhat.com> <514A48DA.40104@redhat.com> In-Reply-To: <514A48DA.40104@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 02/11] change element type from "char" to "unsigned char" in ACPI table data List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: aliguori@us.ibm.com, kraxel@redhat.com, qemu-devel@nongnu.org, mst@redhat.com On 03/21/13 00:40, Eric Blake wrote: > On 03/20/2013 05:23 PM, Laszlo Ersek wrote: >> The data is binary, not textual. >> >> Also, acpi_table_add() abuses the "char *f" pointer -- which normally >> points to file names to load -- to poke into the table. Introduce "char >> unsigned *table_start" for that purpose. >> >> Signed-off-by: Laszlo Ersek >> --- > >> @@ -112,7 +113,7 @@ int acpi_table_add(const char *t) >> } >> >> for (;;) { >> - char data[8192]; >> + char unsigned data[8192]; > > Although this spelling of the type is valid C, it is not typical > convention prior to your patch: > > $ git grep 'unsigned char' | wc > 508 3130 34115 > $ git grep 'char unsigned' | wc > 0 0 0 Will fix if a respin is required! :) >> @@ -225,11 +226,11 @@ int acpi_table_add(const char *t) >> hdr.checksum = 0; /* for checksum calculation */ >> >> /* put header back */ >> - memcpy(f, &hdr, sizeof(hdr)); >> + memcpy(table_start, &hdr, sizeof(hdr)); >> >> if (changed || !has_header || 1) { >> - ((struct acpi_table_header *)f)->checksum = >> - acpi_checksum((uint8_t *)f + ACPI_TABLE_PFX_SIZE, len); >> + ((struct acpi_table_header *)table_start)->checksum = >> + acpi_checksum((uint8_t *)table_start + ACPI_TABLE_PFX_SIZE, len); > > Now that table_start is an unsigned char *, do you still need the cast > to uint8_t*? Hrmpf. Nope. Thankfully this code is going all away later on in the series. Thanks for reviewing it! Laszlo