This patch replaces 0-length trailing arrays with
flexible arrays in htree_lock.h to resolve the UBSAN
array-index-out-of-bounds runtime warnings.
Test-Parameters: mdtcount=4 mdscount=2 \
clientdistro=ubuntu2404 testlist=sanity
Change-Id: I30b624a09f3f918ddaac105fb06db9fd4c693799
Signed-off-by: Jian Yu <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57327
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Shuichi Ihara <sihara@ddn.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
+ /* private data */
+ void *lh_private;
+ /* array of children locks */
-+ struct htree_lock_child lh_children[0];
++ struct htree_lock_child lh_children[];
+};
+
+/* htree_lock_node_t is child-lock for a specific key (ln_value) */
+ unsigned lk_depth;
+ htree_lock_mode_t lk_mode;
+ struct list_head lk_blocked_list;
-+ struct htree_lock_node lk_nodes[0];
++ struct htree_lock_node lk_nodes[];
+};
+
+/* create a lock head, which stands for a resource */