qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] pflash: Avoid warnings from coverity


From: Stefan Weil
Subject: Re: [Qemu-devel] [PATCH] pflash: Avoid warnings from coverity
Date: Wed, 19 Sep 2012 22:51:05 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120827 Thunderbird/15.0

Am 19.09.2012 18:45, schrieb Peter Maydell:
On 19 September 2012 17:41, Stefan Weil <address@hidden> 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 <address@hidden>
---
  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

As far as I know, there is no concept how a flash memory
can report a write error. Flash memory which cannot be
written is unusable.

hw/nand.c uses a similar handling for write errors,
but writes the error message to stdout (no good idea).

- Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]