diff mbox series

[2/2,net-next] libceph: Use __counted_by() in struct ceph_snap_context

Message ID c883cccd53beb412f4806d28f48e8a3ddd4f0995.1716109606.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State New, archived
Headers show
Series [1/2,net-next] libceph: Use sruct_size() in ceph_create_snap_context() | expand

Commit Message

Christophe JAILLET May 19, 2024, 9:09 a.m. UTC
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 <christophe.jaillet@wanadoo.fr>
Compile tested only
 include/linux/ceph/libceph.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series


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,