[master] 33d8a53d4 Coverity polish: 1605316 Overflowed constant

Nils Goroll nils.goroll at uplex.de
Thu Sep 12 12:09:06 UTC 2024


commit 33d8a53d4e4bc43edd8fe5fd8cfd9bc11db078c8
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Sep 12 14:06:48 2024 +0200

    Coverity polish: 1605316 Overflowed constant
    
    Add assertion that we only process wait events which we have counted, anything
    else is a bug.

diff --git a/bin/varnishd/waiter/cache_waiter_epoll.c b/bin/varnishd/waiter/cache_waiter_epoll.c
index 70b71c07d..fb33c1199 100644
--- a/bin/varnishd/waiter/cache_waiter_epoll.c
+++ b/bin/varnishd/waiter/cache_waiter_epoll.c
@@ -105,6 +105,7 @@ vwe_thread(void *priv)
 			}
 			CHECK_OBJ_NOTNULL(wp, WAITED_MAGIC);
 			AZ(epoll_ctl(vwe->epfd, EPOLL_CTL_DEL, wp->fd, NULL));
+			AN(vwe->nwaited);
 			vwe->nwaited--;
 			AN(Wait_HeapDelete(w, wp));
 			Lck_Unlock(&vwe->mtx);
@@ -138,6 +139,7 @@ vwe_thread(void *priv)
 				continue;
 			}
 			AZ(epoll_ctl(vwe->epfd, EPOLL_CTL_DEL, wp->fd, NULL));
+			AN(vwe->nwaited);
 			vwe->nwaited--;
 			if (ep->events & EPOLLIN) {
 				if (ep->events & EPOLLRDHUP &&


More information about the varnish-commit mailing list