[master] 6f374e3d5 tree-wide: apply v_counted_by_(field)

Nils Goroll nils.goroll at uplex.de
Wed Dec 4 14:55:06 UTC 2024


commit 6f374e3d59c6b6ba6dd433ac7270c32651e44bb5
Author: Asad Sajjad Ahmed <asadsa at varnish-software.com>
Date:   Mon Jan 15 14:31:49 2024 +0100

    tree-wide: apply v_counted_by_(field)
    
    Committer edit: Removed one offending case and fixed another, see #4039
    
    Signed-off-by: Asad Sajjad Ahmed <asadsa at varnish-software.com>

diff --git a/bin/varnishd/hpack/vhp_gen_hufdec.c b/bin/varnishd/hpack/vhp_gen_hufdec.c
index a69d1df83..121e897d0 100644
--- a/bin/varnishd/hpack/vhp_gen_hufdec.c
+++ b/bin/varnishd/hpack/vhp_gen_hufdec.c
@@ -72,7 +72,7 @@ struct tbl {
 	unsigned		idx;
 	unsigned		lvl;
 	unsigned		p_idx;
-	struct cod		e[];
+	struct cod		e[] v_counted_by_(n);
 };
 
 static struct tbl *
diff --git a/bin/varnishd/proxy/cache_proxy_proto.c b/bin/varnishd/proxy/cache_proxy_proto.c
index 066be91d3..f8e317a0c 100644
--- a/bin/varnishd/proxy/cache_proxy_proto.c
+++ b/bin/varnishd/proxy/cache_proxy_proto.c
@@ -52,7 +52,7 @@ struct vpx_tlv {
 	unsigned		magic;
 #define VPX_TLV_MAGIC		0xdeb9a4a5
 	unsigned		len;
-	char			tlv[];
+	char			tlv[] v_counted_by_(len);
 };
 
 static inline int
diff --git a/include/vsl_priv.h b/include/vsl_priv.h
index 500aac584..1d8ae1d28 100644
--- a/include/vsl_priv.h
+++ b/include/vsl_priv.h
@@ -63,5 +63,5 @@ struct VSL_head {
 	ssize_t			segsize;
 	unsigned		segment_n;
 	ssize_t			offset[VSL_SEGMENTS];
-	uint32_t		log[];
+	uint32_t		log[] v_counted_by_(segment_n);
 };
diff --git a/lib/libvarnish/vte.c b/lib/libvarnish/vte.c
index cad557b67..0ceb7d02f 100644
--- a/lib/libvarnish/vte.c
+++ b/lib/libvarnish/vte.c
@@ -62,7 +62,8 @@ struct vte {
 	int		f_sz;		/* input field size */
 	int		f_cnt;		/* actual number of fields */
 	int		f_maxcnt;	/* maximum number of fields */
-	int		f_maxsz[];	/* maximum size per field */
+	int		f_maxsz[]
+	    v_counted_by_(f_maxcnt);	/* maximum size per field */
 };
 
 struct vte *


More information about the varnish-commit mailing list