[Spice-devel] [server PATCH 4/4] stat_file_add_node: add "locked" comment
Frediano Ziglio
fziglio at redhat.com
Sun Dec 10 14:31:59 UTC 2017
>
> Coverity complains node->flags is accessed without locking stat_file->lock.
> However the function stat_file_add_node is only called (from
> stat_file_add_counter) when the lock is taken.
>
No, this is false. The function handle the lock.
The problem happens because stat_file_add_counter add a flag without locking.
However in this case this is not much of a problem as the this is the last change of
the flag and maximum cause a temporary view of the node as not counter.
> Add comment so it's clear.
>
> Signed-off-by: Uri Lublin <uril at redhat.com>
> ---
> server/stat-file.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/server/stat-file.c b/server/stat-file.c
> index 2797fd739..9aff8cd72 100644
> --- a/server/stat-file.c
> +++ b/server/stat-file.c
> @@ -139,6 +139,7 @@ static void reds_insert_stat_node(RedStatFile *stat_file,
> StatNodeRef parent, St
> }
> }
>
> +/* Called with stat_file->lock locked */
> StatNodeRef
> stat_file_add_node(RedStatFile *stat_file, StatNodeRef parent, const char
> *name, int visible)
> {
Frediano
More information about the Spice-devel
mailing list