2024-02-13 23:42:44

by Kees Cook

[permalink] [raw]
Subject: [PATCH v2 2/2] net/ipv4: Annotate imsf_slist_flex with __counted_by(imsf_numsrc)

The size of the imsf_slist_flex member is determined by imsf_numsrc, so
annotate it as such.

Cc: "David S. Miller" <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Paolo Abeni <[email protected]>
Cc: [email protected]
Cc: [email protected]
Acked-by: Jakub Kicinski <[email protected]>
Reviewed-by: "Gustavo A. R. Silva" <[email protected]>
Signed-off-by: Kees Cook <[email protected]>
---
include/uapi/linux/in.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/in.h b/include/uapi/linux/in.h
index e682ab628dfa..2f0c4d40bc7b 100644
--- a/include/uapi/linux/in.h
+++ b/include/uapi/linux/in.h
@@ -199,7 +199,8 @@ struct ip_msfilter {
__u32 imsf_numsrc;
union {
__be32 imsf_slist[1];
- __DECLARE_FLEX_ARRAY(__be32, imsf_slist_flex);
+ __DECLARE_FLEX_ARRAY(__be32, imsf_slist_flex,
+ __counted_by(imsf_numsrc));
};
};

--
2.34.1