[master] 94b7087 Don't assert on vtc_error

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Fri May 12 20:53:05 CEST 2017


commit 94b70875d1bd90194ec13e6adc29d329d14a02d4
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Fri May 12 20:43:41 2017 +0200

    Don't assert on vtc_error
    
    Reported by Coverity:
    
        ID 1406102:  Incorrect expression  (ASSERT_SIDE_EFFECT)
        /bin/varnishtest/vtc_http2.c: 852 in receive_frame()
        846                         s->wf = 0;
        847                         AZ(pthread_cond_signal(&s->cond));
        848                 }
        849                 continue;
        850         }
        851         AZ(pthread_mutex_unlock(&hp->mtx));
        >>> CID 1406102:  Incorrect expression  (ASSERT_SIDE_EFFECT)
        >>> Argument "vtc_error" of assert() has a side effect because the
        >>> variable is volatile.  The containing function might work
        >>> differently in a non-debug build.
        852         assert(vtc_error || vsb == NULL);
        853         return (NULL);
        854 }
        855
        856 #define STRTOU32(n, ss, p, v, c)                             \
        857         do {                                                 \
    
    Although I'm not sure how relevant it is since assert() from vas.h
    doesn't remove side effects when no-op'd.

diff --git a/bin/varnishtest/vtc_http2.c b/bin/varnishtest/vtc_http2.c
index 31591ae..4fcd243 100644
--- a/bin/varnishtest/vtc_http2.c
+++ b/bin/varnishtest/vtc_http2.c
@@ -849,7 +849,8 @@ receive_frame(void *priv)
 		continue;
 	}
 	AZ(pthread_mutex_unlock(&hp->mtx));
-	assert(vtc_error || vsb == NULL);
+	if (!vtc_error)
+		AZ(vsb);
 	return (NULL);
 }
 



More information about the varnish-commit mailing list