From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53996) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzOKx-00020q-BG for qemu-devel@nongnu.org; Wed, 26 Oct 2016 09:33:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bzOKr-0000g5-2O for qemu-devel@nongnu.org; Wed, 26 Oct 2016 09:33:47 -0400 References: <1477466334-4078-1-git-send-email-caoj.fnst@cn.fujitsu.com> From: Eric Blake Message-ID: Date: Wed, 26 Oct 2016 08:33:37 -0500 MIME-Version: 1.0 In-Reply-To: <1477466334-4078-1-git-send-email-caoj.fnst@cn.fujitsu.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="rgX2Mm6W7ObI0o1nIoWvet8PssRKph3V9" Subject: Re: [Qemu-devel] [PATCH] util/mmap-alloc: check parameter before using List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cao jin , qemu-devel@nongnu.org, qemu-trivial@nongnu.org Cc: peter.maydell@linaro.org, gkurz@linux.vnet.ibm.com, armbru@redhat.com, mst@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --rgX2Mm6W7ObI0o1nIoWvet8PssRKph3V9 From: Eric Blake To: Cao jin , qemu-devel@nongnu.org, qemu-trivial@nongnu.org Cc: peter.maydell@linaro.org, gkurz@linux.vnet.ibm.com, armbru@redhat.com, mst@redhat.com Message-ID: Subject: Re: [Qemu-devel] [PATCH] util/mmap-alloc: check parameter before using References: <1477466334-4078-1-git-send-email-caoj.fnst@cn.fujitsu.com> In-Reply-To: <1477466334-4078-1-git-send-email-caoj.fnst@cn.fujitsu.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/26/2016 02:18 AM, Cao jin wrote: > Also refactor some code hunk for readability >=20 > Signed-off-by: Cao jin > --- > util/mmap-alloc.c | 20 +++++++++----------- > 1 file changed, 9 insertions(+), 11 deletions(-) >=20 > diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c > index 5a85aa3..92c123a 100644 > --- a/util/mmap-alloc.c > +++ b/util/mmap-alloc.c > @@ -41,6 +41,11 @@ size_t qemu_fd_getpagesize(int fd) > =20 > void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared) > { > + /* Make sure align is a power of 2 */ > + assert(!(align & (align - 1))); Better to spell this: assert(is_power_of_2(align)); at which point the comment is redundant and can be omitted. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --rgX2Mm6W7ObI0o1nIoWvet8PssRKph3V9 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/ iQEcBAEBCAAGBQJYELCxAAoJEKeha0olJ0Nq4MYH/jGg4sBwUkmx1uulQAWkAuce FM9vr2jtkMeU0QYni/1GmG7jUkhUgFYFqfLjVZasbHCXMuadBaOQZP1Kf2WmsXpH rKOzhUIoMnbkEwJJ9hzixhRNbbiqVeEpfnTUIUYBovmKCmoWXzl9gKXy41zXgNng JsXeCaMW970UQ4hZVjAqDfA+Oo3GtYDz15m8o1t2b1vPactHwCD9p0S6nNq1qsA6 M+IaSU4wcgX928Z/ZiLz0YGyI5hgklhmsAZTxGoEXF+bB4KT9kZgSMw24hkzbu7/ ItN4AGgcSqUhhfbSjBmeSXmaiY/lfFlpg2nZ4MbU/YpKXBQkRlSzKP9jt4BhfSc= =ZrdN -----END PGP SIGNATURE----- --rgX2Mm6W7ObI0o1nIoWvet8PssRKph3V9--