From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRiak-0001lc-1J for qemu-devel@nongnu.org; Fri, 05 Feb 2016 10:46:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRiaf-0006he-FS for qemu-devel@nongnu.org; Fri, 05 Feb 2016 10:46:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38692) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRiaf-0006ha-9m for qemu-devel@nongnu.org; Fri, 05 Feb 2016 10:46:33 -0500 References: <1454639122-14027-1-git-send-email-xiecl.fnst@cn.fujitsu.com> From: Eric Blake Message-ID: <56B4C3D7.4040404@redhat.com> Date: Fri, 5 Feb 2016 08:46:31 -0700 MIME-Version: 1.0 In-Reply-To: <1454639122-14027-1-git-send-email-xiecl.fnst@cn.fujitsu.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="VTFAXJ1E9jLtqhKsvfVn8mMKwvIr3MXeJ" Subject: Re: [Qemu-devel] [PATCH V2] quorum: fix segfault when read fails in fifo mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Changlong Xie , qemu devel , Alberto Garcia , Kevin Wolf Cc: "Dr. David Alan Gilbert" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --VTFAXJ1E9jLtqhKsvfVn8mMKwvIr3MXeJ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 02/04/2016 07:25 PM, Changlong Xie wrote: > Signed-off-by: Wen Congyang > Signed-off-by: Changlong Xie > --- > block/quorum.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/block/quorum.c b/block/quorum.c > index a5ae4b8..11cc60b 100644 > --- a/block/quorum.c > +++ b/block/quorum.c > @@ -286,7 +286,8 @@ static void quorum_aio_cb(void *opaque, int ret) > =20 > if (acb->is_read && s->read_pattern =3D=3D QUORUM_READ_PATTERN_FIF= O) { > /* We try to read next child in FIFO order if we fail to read = */ > - if (ret < 0 && ++acb->child_iter < s->num_children) { > + if (ret < 0 && (acb->child_iter + 1) < s->num_children) { Could shorten this as if (ret < 0 && acb->child_iter <=3D s->num_children) { but I'm not sure it's worth the mental gymnastics. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --VTFAXJ1E9jLtqhKsvfVn8mMKwvIr3MXeJ 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/ iQEcBAEBCAAGBQJWtMPXAAoJEKeha0olJ0NqnWMH/RoQ9IX0Yzp8tnsbck/LTABn 97RV3lwSUFFlnPe/F701qRvWMoMFeHywhEm2vdFLRRJ5RmPeC64cSNeH4GBOf6h1 JwGRL6wQT5bueg5OLLpKh77JItDbZaMNAV8nqAQtEeearzlcg5YCgQ8OhK5T5YB1 4BXhZdjmD9Dt6P8TOkEUy/c4zqaMr0IDU/IigaAZL2F6rIIgLHLyFaKWng2sUoxp QU3YquacS54j/CV2chqidhm7uhpU2/AAqAuNhJ23tifxLl9h/ZmekhkcSBKceAb2 Lt9qcWQrZO8oWlVhmwfwEL4/X+nc2LnOaCmb6IjsKWAkqImj7oqGgViFObGh59E= =I6Gd -----END PGP SIGNATURE----- --VTFAXJ1E9jLtqhKsvfVn8mMKwvIr3MXeJ--