From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38983) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQuSp-0006dV-72 for qemu-devel@nongnu.org; Mon, 08 Sep 2014 04:38:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XQuSV-0000OE-8R for qemu-devel@nongnu.org; Mon, 08 Sep 2014 04:38:19 -0400 Received: from mail-we0-x233.google.com ([2a00:1450:400c:c03::233]:58856) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQuSV-0000Nk-2U for qemu-devel@nongnu.org; Mon, 08 Sep 2014 04:37:59 -0400 Received: by mail-we0-f179.google.com with SMTP id u56so1069031wes.38 for ; Mon, 08 Sep 2014 01:37:57 -0700 (PDT) Date: Mon, 8 Sep 2014 09:37:54 +0100 From: Stefan Hajnoczi Message-ID: <20140908083754.GC7638@stefanha-thinkpad.redhat.com> References: <1407747189-7936-1-git-send-email-zhang.zhanghailiang@huawei.com> <1407747189-7936-11-git-send-email-zhang.zhanghailiang@huawei.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="9Ek0hoCL9XbhcSqy" Content-Disposition: inline In-Reply-To: <1407747189-7936-11-git-send-email-zhang.zhanghailiang@huawei.com> Subject: Re: [Qemu-devel] [PATCH v5 10/10] block/vvfat: fix setbuf stream parameter may be NULL List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: zhanghailiang Cc: kwolf@redhat.com, lkurusa@redhat.com, mst@redhat.com, jan.kiszka@siemens.com, riku.voipio@iki.fi, mjt@tls.msk.ru, qemu-devel@nongnu.org, peter.huangpeng@huawei.com, stefanha@redhat.com, Li Liu , luonengjun@huawei.com, pbonzini@redhat.com, lcapitulino@redhat.com, alex.bennee@linaro.org, rth@twiddle.net --9Ek0hoCL9XbhcSqy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 11, 2014 at 04:53:09PM +0800, zhanghailiang wrote: > From: Li Liu >=20 > fopen() may return NULL which will cause setbuf() segmentfault >=20 > Signed-off-by: zhanghailiang > Signed-off-by: Li Liu > --- > block/vvfat.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) >=20 > diff --git a/block/vvfat.c b/block/vvfat.c > index 70176b1..6889ea9 100644 > --- a/block/vvfat.c > +++ b/block/vvfat.c > @@ -1084,7 +1084,10 @@ static int vvfat_open(BlockDriverState *bs, QDict = *options, int flags, > =20 > DLOG(if (stderr =3D=3D NULL) { > stderr =3D fopen("vvfat.log", "a"); > - setbuf(stderr, NULL); > + > + if (stderr) { > + setbuf(stderr, NULL); > + } > }) > =20 > opts =3D qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); This no longer exists: commit 13b552c2f43298a42e26d7aec7b58a5c205b75a0 Author: Michael Tokarev Date: Wed Aug 20 19:02:38 2014 +0400 block/vvfat.c: remove debugging code to reinit stderr if NULL =20 Just log to stderr unconditionally, like other similar code does. =20 Signed-off-by: Michael Tokarev Reviewed-by: Peter Maydell Signed-off-by: Kevin Wolf --9Ek0hoCL9XbhcSqy Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJUDWriAAoJEJykq7OBq3PI4ZkH/jNyJk+htdQ14vh6Dq5Wp6b0 flfY9m3oaq5XE0qxic6KTfcW0WSWGBGcQqJZHgjGIdhMYjqyMfNVuxZQ3oBqtyU3 PKu7C61rPLei4MiWr4W6Sf87ZgPED70M/I200OlSlIDzqYJWgFoUuNAUN6nnvjwq 3c2jkLKqABHZiqq1fcRx530r+bmWWZ9gdqFGuao8b0LYREXUyw1jNWilKbOWw3y6 srisO/J+AZvQ/yZVXp+c7BNPJ2vdJMJ4CeFogLTZ/vaxCfYQ5Wqs4icmQc/B1xuE hkYdBlere/ndmhSxUA2jPpx9PNY7A9FI9SRNr5isFBqJ5LIG4CR4kgbvxDYL5wA= =BEf6 -----END PGP SIGNATURE----- --9Ek0hoCL9XbhcSqy--