2024-05-19 09:10:47

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 2/2 net-next] libceph: Use __counted_by() in struct ceph_snap_context

Annotate the 'snaps' flexible array in "struct ceph_snap_context" with
__counted_by() so that additional checks can be made, if enabled.

Signed-off-by: Christophe JAILLET <[email protected]>
---
Compile tested only
---
include/linux/ceph/libceph.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 4497d0a6772c..485efc8837d5 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -164,7 +164,7 @@ struct ceph_snap_context {
refcount_t nref;
u64 seq;
u32 num_snaps;
- u64 snaps[];
+ u64 snaps[] __counted_by(num_snaps);
};

extern struct ceph_snap_context *ceph_create_snap_context(u32 snap_count,
--
2.45.1