All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/2] Miscellaneous patches for 2017-03-15
@ 2017-03-15 13:18 Markus Armbruster
  2017-03-15 13:18 ` [Qemu-devel] [PULL 1/2] tests: Use error_free_or_abort() where appropriate Markus Armbruster
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Markus Armbruster @ 2017-03-15 13:18 UTC (permalink / raw)
  To: qemu-devel

The following changes since commit d84f714eafedd8bb9d4aaec8b76417bef8e3535e:

  Update version for v2.9.0-rc0 release (2017-03-14 19:18:23 +0000)

are available in the git repository at:

  git://repo.or.cz/qemu/armbru.git tags/pull-misc-2017-03-15

for you to fetch changes up to 4d0e72396b69656f36f484b54ffe64893d793a80:

  coverity-model: model address_space_read/write (2017-03-15 13:59:16 +0100)

----------------------------------------------------------------
Miscellaneous patches for 2017-03-15

----------------------------------------------------------------
Markus Armbruster (1):
      tests: Use error_free_or_abort() where appropriate

Paolo Bonzini (1):
      coverity-model: model address_space_read/write

 scripts/coverity-model.c            | 17 +++++++++++++----
 tests/test-qemu-opts.c              |  3 +--
 tests/test-qobject-output-visitor.c |  6 ++----
 3 files changed, 16 insertions(+), 10 deletions(-)

Markus Armbruster (1):
  tests: Use error_free_or_abort() where appropriate

Paolo Bonzini (1):
  coverity-model: model address_space_read/write

 scripts/coverity-model.c            | 17 +++++++++++++----
 tests/test-qemu-opts.c              |  3 +--
 tests/test-qobject-output-visitor.c |  6 ++----
 3 files changed, 16 insertions(+), 10 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PULL 1/2] tests: Use error_free_or_abort() where appropriate
  2017-03-15 13:18 [Qemu-devel] [PULL 0/2] Miscellaneous patches for 2017-03-15 Markus Armbruster
@ 2017-03-15 13:18 ` Markus Armbruster
  2017-03-15 13:18 ` [Qemu-devel] [PULL 2/2] coverity-model: model address_space_read/write Markus Armbruster
  2017-03-15 18:41 ` [Qemu-devel] [PULL 0/2] Miscellaneous patches for 2017-03-15 Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Markus Armbruster @ 2017-03-15 13:18 UTC (permalink / raw)
  To: qemu-devel

Done with this Coccinelle semantic patch:

    @@
    expression E;
    @@
    -    g_assert(E);
    -    error_free(E);
    +    error_free_or_abort(&E);

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1487362554-5688-1-git-send-email-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
 tests/test-qemu-opts.c              | 3 +--
 tests/test-qobject-output-visitor.c | 6 ++----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/tests/test-qemu-opts.c b/tests/test-qemu-opts.c
index f6310b3..0ad74b4 100644
--- a/tests/test-qemu-opts.c
+++ b/tests/test-qemu-opts.c
@@ -93,8 +93,7 @@ static void test_find_unknown_opts(void)
     /* should not return anything, we don't have an "unknown" option */
     list = qemu_find_opts_err("unknown", &err);
     g_assert(list == NULL);
-    g_assert(err);
-    error_free(err);
+    error_free_or_abort(&err);
 }
 
 static void test_qemu_find_opts(void)
diff --git a/tests/test-qobject-output-visitor.c b/tests/test-qobject-output-visitor.c
index 500b452..c213fce 100644
--- a/tests/test-qobject-output-visitor.c
+++ b/tests/test-qobject-output-visitor.c
@@ -145,8 +145,7 @@ static void test_visitor_out_enum_errors(TestOutputVisitorData *data,
     for (i = 0; i < ARRAY_SIZE(bad_values) ; i++) {
         err = NULL;
         visit_type_EnumOne(data->ov, "unused", &bad_values[i], &err);
-        g_assert(err);
-        error_free(err);
+        error_free_or_abort(&err);
         visitor_reset(data);
     }
 }
@@ -244,8 +243,7 @@ static void test_visitor_out_struct_errors(TestOutputVisitorData *data,
         u.has_enum1 = true;
         u.enum1 = bad_values[i];
         visit_type_UserDefOne(data->ov, "unused", &pu, &err);
-        g_assert(err);
-        error_free(err);
+        error_free_or_abort(&err);
         visitor_reset(data);
     }
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PULL 2/2] coverity-model: model address_space_read/write
  2017-03-15 13:18 [Qemu-devel] [PULL 0/2] Miscellaneous patches for 2017-03-15 Markus Armbruster
  2017-03-15 13:18 ` [Qemu-devel] [PULL 1/2] tests: Use error_free_or_abort() where appropriate Markus Armbruster
@ 2017-03-15 13:18 ` Markus Armbruster
  2017-03-15 18:41 ` [Qemu-devel] [PULL 0/2] Miscellaneous patches for 2017-03-15 Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Markus Armbruster @ 2017-03-15 13:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini

From: Paolo Bonzini <pbonzini@redhat.com>

Commit eb7eeb8 ("memory: split address_space_read and
address_space_write", 2015-12-17) made address_space_rw
dispatch to one of address_space_read or address_space_write,
rather than vice versa.

For callers of address_space_read and address_space_write this
causes false positive defects when Coverity sees a length-8 write in
address_space_read and a length-4 (e.g. int*) buffer to read into.
As long as the size of the buffer is okay, this is a false positive.

Reflect the code change into the model.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20170315081641.20588-1-pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 scripts/coverity-model.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/scripts/coverity-model.c b/scripts/coverity-model.c
index ee5bf9d..c702804 100644
--- a/scripts/coverity-model.c
+++ b/scripts/coverity-model.c
@@ -67,18 +67,27 @@ static void __bufread(uint8_t *buf, ssize_t len)
     int last = buf[len-1];
 }
 
-MemTxResult address_space_rw(AddressSpace *as, hwaddr addr, MemTxAttrs attrs,
-                             uint8_t *buf, int len, bool is_write)
+MemTxResult address_space_read(AddressSpace *as, hwaddr addr,
+                               MemTxAttrs attrs,
+                               uint8_t *buf, int len)
 {
     MemTxResult result;
-
     // TODO: investigate impact of treating reads as producing
     // tainted data, with __coverity_tainted_data_argument__(buf).
-    if (is_write) __bufread(buf, len); else __bufwrite(buf, len);
+    __bufwrite(buf, len);
+    return result;
+}
 
+MemTxResult address_space_write(AddressSpace *as, hwaddr addr,
+                                MemTxAttrs attrs,
+                                const uint8_t *buf, int len)
+{
+    MemTxResult result;
+    __bufread(buf, len);
     return result;
 }
 
+
 /* Tainting */
 
 typedef struct {} name2keysym_t;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PULL 0/2] Miscellaneous patches for 2017-03-15
  2017-03-15 13:18 [Qemu-devel] [PULL 0/2] Miscellaneous patches for 2017-03-15 Markus Armbruster
  2017-03-15 13:18 ` [Qemu-devel] [PULL 1/2] tests: Use error_free_or_abort() where appropriate Markus Armbruster
  2017-03-15 13:18 ` [Qemu-devel] [PULL 2/2] coverity-model: model address_space_read/write Markus Armbruster
@ 2017-03-15 18:41 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2017-03-15 18:41 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: QEMU Developers

On 15 March 2017 at 13:18, Markus Armbruster <armbru@redhat.com> wrote:
> The following changes since commit d84f714eafedd8bb9d4aaec8b76417bef8e3535e:
>
>   Update version for v2.9.0-rc0 release (2017-03-14 19:18:23 +0000)
>
> are available in the git repository at:
>
>   git://repo.or.cz/qemu/armbru.git tags/pull-misc-2017-03-15
>
> for you to fetch changes up to 4d0e72396b69656f36f484b54ffe64893d793a80:
>
>   coverity-model: model address_space_read/write (2017-03-15 13:59:16 +0100)
>
> ----------------------------------------------------------------
> Miscellaneous patches for 2017-03-15
>
> ----------------------------------------------------------------
> Markus Armbruster (1):
>       tests: Use error_free_or_abort() where appropriate
>
> Paolo Bonzini (1):
>       coverity-model: model address_space_read/write
>
>  scripts/coverity-model.c            | 17 +++++++++++++----
>  tests/test-qemu-opts.c              |  3 +--
>  tests/test-qobject-output-visitor.c |  6 ++----
>  3 files changed, 16 insertions(+), 10 deletions(-)
>
> Markus Armbruster (1):
>   tests: Use error_free_or_abort() where appropriate
>
> Paolo Bonzini (1):
>   coverity-model: model address_space_read/write

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-15 18:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-15 13:18 [Qemu-devel] [PULL 0/2] Miscellaneous patches for 2017-03-15 Markus Armbruster
2017-03-15 13:18 ` [Qemu-devel] [PULL 1/2] tests: Use error_free_or_abort() where appropriate Markus Armbruster
2017-03-15 13:18 ` [Qemu-devel] [PULL 2/2] coverity-model: model address_space_read/write Markus Armbruster
2017-03-15 18:41 ` [Qemu-devel] [PULL 0/2] Miscellaneous patches for 2017-03-15 Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.