Skip to contentSkip to conversation

Miscellaneous patches for 2017-03-15

GIT PULL Applied Markus Armbruster 2 participants 4 messages Mar 15, 2017

lore
Share & tools
lore
#0 lore raw

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(-)
Signature · 1 line
2.7.4
#1 lore raw

[Qemu-devel] [PULL 1/2] tests: Use error_free_or_abort() where appropriate

Done with this Coccinelle semantic patch:

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

Message-Id: <[email protected]>

---
 tests/test-qemu-opts.c              | 3 +--
 tests/test-qobject-output-visitor.c | 6 ++----
 2 files changed, 3 insertions(+), 6 deletions(-)
tests/test-qemu-opts.c +1 -2
index f6310b3..0ad74b4 100644
@@ -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)
tests/test-qobject-output-visitor.c +2 -4
index 500b452..c213fce 100644
@@ -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);
     }
 }
Signature · 1 line
2.7.4
#2 lore raw

[Qemu-devel] [PULL 2/2] coverity-model: model address_space_read/write

In reply to Markus Armbruster

From: Paolo Bonzini <[email protected]>

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.

Message-Id: <[email protected]>

---
 scripts/coverity-model.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
scripts/coverity-model.c +13 -4
index ee5bf9d..c702804 100644
@@ -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;
Signature · 1 line
2.7.4
#3 lore raw
In reply to Markus Armbruster
Quoted 27 lines · Markus Armbruster

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(-)
Quoted 5 lines

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

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

Applied, thanks.

-- PMM