]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dm vdo: add __counted_by attribute to a number of structures
authorKen Raeburn <raeburn@redhat.com>
Fri, 27 Feb 2026 01:12:08 +0000 (20:12 -0500)
committerMikulas Patocka <mpatocka@redhat.com>
Mon, 2 Mar 2026 16:03:37 +0000 (17:03 +0100)
This attribute allows the compiler to refine compile-time diagnostics
and run-time sanitizer features with information about the size of the
flexible arrays.

Signed-off-by: Ken Raeburn <raeburn@redhat.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
drivers/md/dm-vdo/block-map.h
drivers/md/dm-vdo/dedupe.c
drivers/md/dm-vdo/indexer/index.h
drivers/md/dm-vdo/indexer/open-chapter.h
drivers/md/dm-vdo/logical-zone.h
drivers/md/dm-vdo/physical-zone.c
drivers/md/dm-vdo/repair.c
drivers/md/dm-vdo/slab-depot.h

index 39a13039e4a35b874edc56b1d75d19db5cb44b79..4fd24043b0d7677a78b6071418ba62a756a0bff7 100644 (file)
@@ -276,7 +276,7 @@ struct block_map {
        block_count_t next_entry_count;
 
        zone_count_t zone_count;
-       struct block_map_zone zones[];
+       struct block_map_zone zones[] __counted_by(zone_count);
 };
 
 /**
index 4e0fefd077d07720c96dddf02b518ce8d34e98fa..5f5639d89bc6d175fcafb10e0a6595443a6338cc 100644 (file)
@@ -296,7 +296,7 @@ struct hash_zones {
        /* The number of zones */
        zone_count_t zone_count;
        /* The hash zones themselves */
-       struct hash_zone zones[];
+       struct hash_zone zones[] __counted_by(zone_count);
 };
 
 /* These are in milliseconds. */
index edabb239548ec93f68f33a81ee68da9ba990f78c..1891f2de508ee1a5ca41366d8ca300bbb2e1f198 100644 (file)
@@ -53,7 +53,7 @@ struct uds_index {
 
        index_callback_fn callback;
        struct uds_request_queue *triage_queue;
-       struct uds_request_queue *zone_queues[];
+       struct uds_request_queue *zone_queues[] __counted_by(zone_count);
 };
 
 enum request_stage {
index a4250bb19525ec9714fdbcc26523672fc40dd3be..ea6d7336aea01ce2721649c4d057c96d2047ebe7 100644 (file)
@@ -40,7 +40,7 @@ struct open_chapter_zone {
        /* The number of slots in the hash table */
        unsigned int slot_count;
        /* The hash table slots, referencing virtual record numbers */
-       struct open_chapter_zone_slot slots[];
+       struct open_chapter_zone_slot slots[] __counted_by(slot_count);
 };
 
 int __must_check uds_make_open_chapter(const struct index_geometry *geometry,
index 1b666c84a1935d5f3c14578b43b47bf7e517e6cf..a36a864c6836edf9ecc8cea39644159438b256ad 100644 (file)
@@ -60,7 +60,7 @@ struct logical_zones {
        /* The number of zones */
        zone_count_t zone_count;
        /* The logical zones themselves */
-       struct logical_zone zones[];
+       struct logical_zone zones[] __counted_by(zone_count);
 };
 
 int __must_check vdo_make_logical_zones(struct vdo *vdo,
index a8c7a57516eb8770193a55a8abcac8b67f01c850..d6ad8f1a33bbf87367f02a7d19bb6efffb2d8372 100644 (file)
@@ -200,7 +200,7 @@ struct pbn_lock_pool {
        /** @idle_list: A list containing all idle PBN lock instances. */
        struct list_head idle_list;
        /** @locks: The memory for all the locks allocated by this pool. */
-       idle_pbn_lock locks[];
+       idle_pbn_lock locks[] __counted_by(capacity);
 };
 
 /**
index 43ce65a69e618a408163ab8ac398406911eeea44..bfed622602803cfd378f5c88bc821bb8f9f216de 100644 (file)
@@ -127,7 +127,7 @@ struct repair_completion {
         * The page completions used for playing the journal into the block map, and, during
         * read-only rebuild, for rebuilding the reference counts from the block map.
         */
-       struct vdo_page_completion page_completions[];
+       struct vdo_page_completion page_completions[] __counted_by(page_count);
 };
 
 /*
index fadc0c9d4dc48fd0aec617afdc6515f71db46c16..6bfd61c937b6221b71150b28fc48563f2f2a48b3 100644 (file)
@@ -509,7 +509,7 @@ struct slab_depot {
        struct slab_summary_entry *summary_entries;
 
        /* The block allocators for this depot */
-       struct block_allocator allocators[];
+       struct block_allocator allocators[] __counted_by(zone_count);
 };
 
 struct reference_updater;