qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: weidong.huang@huawei.com, luonengjun@huawei.com,
	Markus Armbruster <armbru@redhat.com>,
	qemu-devel@nongnu.org, arei.gonglei@huawei.com,
	stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH] audio: Fix using freed pointer in wav_fini_out
Date: Fri, 13 Jun 2014 10:18:14 +0200	[thread overview]
Message-ID: <539AB3C6.4010103@redhat.com> (raw)
In-Reply-To: <1402646365.21444.21.camel@nilsson.home.kraxel.org>

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

  reply	other threads:[~2014-06-13  8:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-13  1:46 [Qemu-devel] [PATCH] audio: Fix using freed pointer in wav_fini_out arei.gonglei
2014-06-13  7:15 ` Markus Armbruster
2014-06-13  7:23   ` Peter Maydell
2014-06-13  7:47   ` Paolo Bonzini
2014-06-13  7:59     ` Gerd Hoffmann
2014-06-13  8:18       ` Paolo Bonzini [this message]
2014-06-13  8:32         ` Gonglei (Arei)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=539AB3C6.4010103@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=armbru@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=luonengjun@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=weidong.huang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).