[Spice-commits] server/stat-file.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Tue Dec 19 12:19:27 UTC 2017

 server/stat-file.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit bde8ef5a4e5d04beb50d158e37bf7665419f6eee
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Tue Dec 12 17:20:39 2017 +0000

    stat-file: Protect flags field with atomic operation
    Coverity complaint that this field should be protected by
    a mutex as other accesses are with the mutex locked.
    Use atomic operation. Not in an hot path in any case.
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Uri Lublin <uril at redhat.com>

diff --git a/server/stat-file.c b/server/stat-file.c
index 2797fd73..45dece65 100644
--- a/server/stat-file.c
+++ b/server/stat-file.c
@@ -190,7 +190,7 @@ stat_file_add_counter(RedStatFile *stat_file, StatNodeRef parent, const char *na
         return NULL;
     node = &stat_file->stat->nodes[ref];
-    node->flags |= SPICE_STAT_NODE_FLAG_VALUE;
+    __sync_or_and_fetch(&node->flags, SPICE_STAT_NODE_FLAG_VALUE);
     return &node->value;

More information about the Spice-commits mailing list