[master] 85e79d069 varnishtest: Remove critical section

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon May 31 04:38:06 UTC 2021


commit 85e79d069ff37da1154936e53eafd5ce7c18c2f6
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Mon May 31 06:32:36 2021 +0200

    varnishtest: Remove critical section
    
    The buf_len field is only ever modified by the poll thread and should not
    need to be guarded here. This will hopefully silence a coverity warning:
    
       CID 1485138:  Concurrent data access violations  (ATOMICITY)
       Using an unreliable value of "l" inside the second locked
       section. If the data that "l" depends on was changed by
       another thread, this use might be incorrect.
    
    It might on the other hand complain even harder, I have an alternative
    if that happens.

diff --git a/bin/varnishtest/vtc_tunnel.c b/bin/varnishtest/vtc_tunnel.c
index d26c73e16..28fc05ec0 100644
--- a/bin/varnishtest/vtc_tunnel.c
+++ b/bin/varnishtest/vtc_tunnel.c
@@ -345,9 +345,7 @@ tunnel_write(struct tunnel *t, struct vtclog *vl, struct tunnel_lane *lane,
 	ssize_t res, l;
 
 	p = lane->buf;
-	AZ(pthread_mutex_lock(&t->mtx));
 	l = lane->buf_len;
-	AZ(pthread_mutex_unlock(&t->mtx));
 
 	if (l > 0)
 		vtc_log(vl, 3, "%s %zd bytes", action, l);


More information about the varnish-commit mailing list