Re: [server PATCH 4/4] stat_file_add_node: add "locked" comment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> 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@xxxxxxxxxx>
> ---
>  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
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]