From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46947) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TENPR-0002q1-QY for qemu-devel@nongnu.org; Wed, 19 Sep 2012 12:45:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TENPQ-0008UY-S0 for qemu-devel@nongnu.org; Wed, 19 Sep 2012 12:45:57 -0400 Received: from mail-ie0-f173.google.com ([209.85.223.173]:44213) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TENPQ-0008UM-MZ for qemu-devel@nongnu.org; Wed, 19 Sep 2012 12:45:56 -0400 Received: by iebc10 with SMTP id c10so1756167ieb.4 for ; Wed, 19 Sep 2012 09:45:56 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1348072874-2096-1-git-send-email-sw@weilnetz.de> References: <1348072874-2096-1-git-send-email-sw@weilnetz.de> Date: Wed, 19 Sep 2012 17:45:55 +0100 Message-ID: From: Peter Maydell Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH] pflash: Avoid warnings from coverity List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org On 19 September 2012 17:41, Stefan Weil wrote: > hw/pflash_cfi01.c:209: > check_return: Calling function "bdrv_write" without checking return value (as is done elsewhere 35 out of 37 times). > > hw/pflash_cfi02.c:144: > unterminated_default: The default case is not terminated by a 'break' statement. > > hw/pflash_cfi02.c:238: > check_return: Calling function "bdrv_write" without checking return value (as is done elsewhere 35 out of 37 times). > > Signed-off-by: Stefan Weil > --- > hw/pflash_cfi01.c | 6 ++++-- > hw/pflash_cfi02.c | 7 +++++-- > 2 files changed, 9 insertions(+), 4 deletions(-) > > diff --git a/hw/pflash_cfi01.c b/hw/pflash_cfi01.c > index 56ed33f..27ae4aa 100644 > --- a/hw/pflash_cfi01.c > +++ b/hw/pflash_cfi01.c > @@ -205,8 +205,10 @@ static void pflash_update(pflash_t *pfl, int offset, > /* round to sectors */ > offset = offset >> 9; > offset_end = (offset_end + 511) >> 9; > - bdrv_write(pfl->bs, offset, pfl->storage + (offset << 9), > - offset_end - offset); > + if (bdrv_write(pfl->bs, offset, pfl->storage + (offset << 9), > + offset_end - offset) == -1) { > + fprintf(stderr, "pflash: Error writing to flash storage\n"); > + } ...shouldn't we be propagating the write error up to the guest? It feels like this change is just silencing the coverity error without actually fixing the underlying problem. -- PMM