From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57325) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbVij-0007S3-7d for qemu-devel@nongnu.org; Mon, 14 Sep 2015 11:31:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZbVig-0004ul-FY for qemu-devel@nongnu.org; Mon, 14 Sep 2015 11:31:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59990) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbVig-0004uJ-B2 for qemu-devel@nongnu.org; Mon, 14 Sep 2015 11:31:02 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id EA810AACCA for ; Mon, 14 Sep 2015 15:31:01 +0000 (UTC) References: <1442228637-31481-4-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <55F6E832.2010505@redhat.com> Date: Mon, 14 Sep 2015 09:30:58 -0600 MIME-Version: 1.0 In-Reply-To: <1442228637-31481-4-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="7eSxP4TTFcIbNI3micVsFtBHMUN2rhA1U" Subject: Re: [Qemu-devel] [PATCH] usb: Use g_new() & friends where that makes obvious sense List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: kraxel@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --7eSxP4TTFcIbNI3micVsFtBHMUN2rhA1U Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/14/2015 05:03 AM, Markus Armbruster wrote: > g_new(T, n) is neater than g_malloc(sizeof(T) * n). It's also safer, > for two reasons. One, it catches multiplication overflowing size_t. > Two, it returns T * rather than void *, which lets the compiler catch > more type errors. >=20 > This commit only touches allocations with size arguments of the form > sizeof(T). Same Coccinelle semantic patch as in commit b45c03f. >=20 > Signed-off-by: Markus Armbruster > --- > hw/usb/ccid-card-emulated.c | 4 ++-- > hw/usb/dev-mtp.c | 3 +-- > hw/usb/hcd-xhci.c | 2 +- > hw/usb/redirect.c | 6 +++--- > 4 files changed, 7 insertions(+), 8 deletions(-) >=20 Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --7eSxP4TTFcIbNI3micVsFtBHMUN2rhA1U Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJV9ugzAAoJEKeha0olJ0NqJ1oH/2LqktP4tIY66JCMwN9EL8BV AIN81nHoaZmZq3tlvMdVi45bWhAO3uPZKdITbTOcVictyKLGl5zAE4A3H1a3AgmT K2pgkYdtgVytQz34B03eBoaCFj1Oj5tZxbUogWfAFUYmMZJ4FNLf6RdhTZuyTOYQ yRrv4jmwyIAyh2PDVjnnjMZ1hHs5P+xEApVuKgAc8KvCqUUU99IRkzWEBZkRAfeH pi7DtpG9sWeL4LRZ7A8qEBmKvX4TkDFlDGWqd2Qf694SgsEN4ELcM/K4o55cl9VA 6ACIVzp1yihkLS6waBGmEhfUP+qRqXIC5yMFoNBjnFuZQZwsWoaW+bcSLbgZGz4= =L0uB -----END PGP SIGNATURE----- --7eSxP4TTFcIbNI3micVsFtBHMUN2rhA1U--