From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaBZ2-0002cr-7o for qemu-devel@nongnu.org; Thu, 10 Sep 2015 19:47:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZaBZ0-0003US-Pb for qemu-devel@nongnu.org; Thu, 10 Sep 2015 19:47:36 -0400 References: <1441926555-19471-1-git-send-email-jsnow@redhat.com> <1441926555-19471-2-git-send-email-jsnow@redhat.com> From: Eric Blake Message-ID: <55F21689.1080608@redhat.com> Date: Thu, 10 Sep 2015 17:47:21 -0600 MIME-Version: 1.0 In-Reply-To: <1441926555-19471-2-git-send-email-jsnow@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="EGTTh1dV9G4uHdVBtxoX4WNQqJtMOKTDa" Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v2 1/4] qtest/ahci: use generate_pattern everywhere List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow , qemu-block@nongnu.org Cc: kwolf@redhat.com, armbru@redhat.com, zuban32s@gmail.com, qemu-devel@nongnu.org, stefanha@redhat.com, pbonzini@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --EGTTh1dV9G4uHdVBtxoX4WNQqJtMOKTDa Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/10/2015 05:09 PM, John Snow wrote: > Fix the pattern generation to actually be interesting, > and make sure all buffers in the ahci-test actually use it. >=20 > Signed-off-by: John Snow > --- > tests/ahci-test.c | 23 ++++++----------------- > 1 file changed, 6 insertions(+), 17 deletions(-) >=20 > diff --git a/tests/ahci-test.c b/tests/ahci-test.c > index 87d7691..b1a785c 100644 > --- a/tests/ahci-test.c > +++ b/tests/ahci-test.c > @@ -80,9 +80,9 @@ static void generate_pattern(void *buffer, size_t len= , size_t cycle_len) > =20 > /* Write an indicative pattern that varies and is unique per-cycle= */ > p =3D rand() % 256; > - for (i =3D j =3D 0; i < len; i++, j++) { > - tx[i] =3D p; > - if (j % cycle_len =3D=3D 0) { > + for (i =3D 0; i < len; i++) { > + tx[i] =3D p++ % 256; > + if (i % cycle_len =3D=3D 0) { > p =3D rand() % 256; I'd drop the pointless %256, since the compiler already automatically truncates int to char when assigning to a char variable. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --EGTTh1dV9G4uHdVBtxoX4WNQqJtMOKTDa 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/ iQEcBAEBCAAGBQJV8haJAAoJEKeha0olJ0Nq05oIAI+oLpJhPXtYmPr10hlsuvGI ku3RJeXdAjlQVLjBT+aukStCY8ytmv3u4JtD4f+M/rs+WhRq7Iy0EUDCF/NutIEf e04n6sdeTMERToltW+2vXWrSlxWpblRIehScDrTNIRyz/tfzemwBQlkxNZmLZz1p kNGI9OOMYJc27DvgyC/zCfIk5fekRzRFTleQgzun1esZi5yjH5Vb3k9EM+vA4j6C zJhCmg1zf7S+xWuHRay4zPG3rWmj1X25fbZ88Ooi9kiT3YUdJ+t7fO+hoUu+K+iR lMR1DeoT17uu7HTZjCl5cuQ0EIbL5S87Y82G/LQGcy36n/dTDqN8y0vPbkwA5yc= =t5X2 -----END PGP SIGNATURE----- --EGTTh1dV9G4uHdVBtxoX4WNQqJtMOKTDa--