From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50978) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIScJ-0006UG-Ey for qemu-devel@nongnu.org; Wed, 20 Mar 2013 19:40:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIScG-0000eM-Hp for qemu-devel@nongnu.org; Wed, 20 Mar 2013 19:40:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16692) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIScG-0000Xx-9I for qemu-devel@nongnu.org; Wed, 20 Mar 2013 19:40:20 -0400 Message-ID: <514A48DA.40104@redhat.com> Date: Wed, 20 Mar 2013 17:40:10 -0600 From: Eric Blake MIME-Version: 1.0 References: <1363821803-3380-1-git-send-email-lersek@redhat.com> <1363821803-3380-3-git-send-email-lersek@redhat.com> In-Reply-To: <1363821803-3380-3-git-send-email-lersek@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2RKIFFKBVSUJSLTQQQRGO" 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: Laszlo Ersek Cc: aliguori@us.ibm.com, kraxel@redhat.com, qemu-devel@nongnu.org, mst@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2RKIFFKBVSUJSLTQQQRGO Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 03/20/2013 05:23 PM, Laszlo Ersek wrote: > The data is binary, not textual. >=20 > 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. >=20 > Signed-off-by: Laszlo Ersek > --- > @@ -112,7 +113,7 @@ int acpi_table_add(const char *t) > } > =20 > 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 > @@ -225,11 +226,11 @@ int acpi_table_add(const char *t) > hdr.checksum =3D 0; /* for checksum calculation */ > =20 > /* put header back */ > - memcpy(f, &hdr, sizeof(hdr)); > + memcpy(table_start, &hdr, sizeof(hdr)); > =20 > if (changed || !has_header || 1) { > - ((struct acpi_table_header *)f)->checksum =3D > - acpi_checksum((uint8_t *)f + ACPI_TABLE_PFX_SIZE, len); > + ((struct acpi_table_header *)table_start)->checksum =3D > + 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*? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2RKIFFKBVSUJSLTQQQRGO Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRSkjaAAoJEKeha0olJ0NqOm8H/R7ZlfyFgs1e+2TNek9osNx/ 5qTXkkllN6tFjRyQ1HsAaQJyE2PblNYOQ1ty3up1A9PnqT/afSlnevZ69Rpb9FJp 3hPmy457l0x/G1GGhb7L8itt4GPhR+JJssCgDinjkfryQAcRSIUjiYOZ+jcEAAGE 8M6ueysDdGdWxwkeljLF5idQyYUM5Iu5zmOsplrJtG9ag5f17q1lxvjiwhCFQXgG zq6C7LoCkpStVmN2cc5UwWhSETBPr5AX5g5Jrq7MgXjDsLKwkeMLY9pL2ojyL77C 5U7LeG3qBpFXIAJC71WPSBe7yxBZwZNpymZRiUYIpiBpXjPYbaGThEx5TmyzW6s= =tmWe -----END PGP SIGNATURE----- ------enig2RKIFFKBVSUJSLTQQQRGO--