From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58919) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvMgw-0002su-Ly for qemu-devel@nongnu.org; Fri, 13 Jun 2014 04:18:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WvMgq-0000Gv-HG for qemu-devel@nongnu.org; Fri, 13 Jun 2014 04:18:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1797) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WvMgq-0000Gr-8L for qemu-devel@nongnu.org; Fri, 13 Jun 2014 04:18:24 -0400 Message-ID: <539AB3C6.4010103@redhat.com> Date: Fri, 13 Jun 2014 10:18:14 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1402624000-4896-1-git-send-email-arei.gonglei@huawei.com> <87vbs5s2kc.fsf@blackfin.pond.sub.org> <539AAC98.8010902@redhat.com> <1402646365.21444.21.camel@nilsson.home.kraxel.org> In-Reply-To: <1402646365.21444.21.camel@nilsson.home.kraxel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] audio: Fix using freed pointer in wav_fini_out List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: weidong.huang@huawei.com, luonengjun@huawei.com, Markus Armbruster , qemu-devel@nongnu.org, arei.gonglei@huawei.com, stefanha@redhat.com Il 13/06/2014 09:59, Gerd Hoffmann ha scritto: > On Fr, 2014-06-13 at 09:47 +0200, Paolo Bonzini wrote: >> Il 13/06/2014 09:15, Markus Armbruster ha scritto: >>> I'm afraid this is not an improvement. >>> >>> Your patch makes the code ignore fclose() failure silently. This is a >>> common mistake. fclose() failure after write can mean data loss, and >>> the user certainly needs to know about that. >> >> If you want that, the best solution is to first fflush() and then >> fclose(). > > Agree. If you really care you'll go flush/sync before close, so you > still have a valid file handle when you see the failure. > > Question is do we really need that here? This isn't your virtual disk, > it's just a few audio samples which might get lost ... I think sticking to fflush+fclose is a good idea anyway, if only for discipline. If Gonglei wants to do that, why not. :) Otherwise, it's easy to mark the bug as intentional in Coverity. Paolo