[Spice-devel] [RFC] QXLDevSurfaceCreate: reorder fields to avoid holes on 64-bit arches.

Alon Levy alevy at redhat.com
Tue May 22 07:27:06 PDT 2012


The hole remains uninitialized variable when allocating an instance of
QXLDevSurfaceCreate on the stack and setting each field individually,
producing an uninteresting valgrind warning. The reordering fixes this.
It also requires bumping the version of the server.
---
What's the suggested course here? just ignore this and either add memset in
qemu or just pretend I don't see the uninitialized value in valgrind, or push
this and what - raise the primary version number (and assume all users actually
check for the exact primary and not for a larger then relation..) ?

 server/spice.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/spice.h b/server/spice.h
index 77aec92..ef2c6d3 100644
--- a/server/spice.h
+++ b/server/spice.h
@@ -203,6 +203,7 @@ struct QXLDevMemSlot {
 };
 
 struct QXLDevSurfaceCreate {
+    uint64_t mem;
     uint32_t width;
     uint32_t height;
     int32_t stride;
@@ -211,7 +212,6 @@ struct QXLDevSurfaceCreate {
     uint32_t mouse_mode;
     uint32_t flags;
     uint32_t type;
-    uint64_t mem;
     uint32_t group_id;
 };
 
-- 
1.7.10.1



More information about the Spice-devel mailing list