[master] c862063ac Always return whatever length we managed to allocate.

Poul-Henning Kamp phk at FreeBSD.org
Tue Oct 25 17:48:04 UTC 2022


commit c862063ace8a810dc65af0a7e669f74beeea8f12
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Oct 25 17:47:39 2022 +0000

    Always return whatever length we managed to allocate.

diff --git a/bin/varnishd/cache/cache_shmlog.c b/bin/varnishd/cache/cache_shmlog.c
index 48ea0f9cc..c166b5648 100644
--- a/bin/varnishd/cache/cache_shmlog.c
+++ b/bin/varnishd/cache/cache_shmlog.c
@@ -350,10 +350,11 @@ vslb_get(struct vsl_log *vsl, enum VSL_tag_e tag, unsigned *length)
 
 	/* If it still doesn't fit, truncate */
 	if (VSL_END(vsl->wlp, mlen) > vsl->wle)
-		*length = mlen = ((char *)vsl->wle) - VSL_DATA(vsl->wlp);
+		mlen = ((char *)vsl->wle) - VSL_DATA(vsl->wlp);
 
 	vsl->wlp = vsl_hdr(tag, vsl->wlp, mlen, vsl->wid);
 	vsl->wlr++;
+	*length = mlen;
 	return (retval);
 }
 


More information about the varnish-commit mailing list