]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/xe: Use __counted_by for flexible arrays
authorMatthew Brost <matthew.brost@intel.com>
Fri, 18 Oct 2024 03:00:39 +0000 (20:00 -0700)
committerMatthew Brost <matthew.brost@intel.com>
Sun, 20 Oct 2024 21:48:51 +0000 (14:48 -0700)
Good practice to use __counted_by in kernel coding for flexible arrays.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241018030039.1077842-1-matthew.brost@intel.com
drivers/gpu/drm/xe/xe_exec_queue_types.h
drivers/gpu/drm/xe/xe_sched_job_types.h

index 7deb480e26af0e6e05443ad34c995ee9748f9cd8..1158b6062a6cd18e1df23a42848131658e7c78d3 100644 (file)
@@ -143,7 +143,7 @@ struct xe_exec_queue {
        /** @hw_engine_group_link: link into exec queues in the same hw engine group */
        struct list_head hw_engine_group_link;
        /** @lrc: logical ring context for this exec queue */
-       struct xe_lrc *lrc[];
+       struct xe_lrc *lrc[] __counted_by(width);
 };
 
 /**
index 0d3f76fb05cea289f481ae15ed431db1f77049e1..426d261d7359c66ea51e1641c1cc4c17605ab476 100644 (file)
@@ -63,7 +63,7 @@ struct xe_sched_job {
 
 struct xe_sched_job_snapshot {
        u16 batch_addr_len;
-       u64 batch_addr[];
+       u64 batch_addr[] __counted_by(batch_addr_len);
 };
 
 #endif