Whamcloud - gitweb
LU-17794 lustre: replace 0-length arrays with flexible arrays (3/3)
This patch replaces 0-length arrays with flexible arrays to
resolve the UBSAN array-index-out-of-bounds runtime warnings.
Most replacement of 0-length arrays with flexible arrays
requires no special handling. Simply removing the “0” in
the array declaration is sufficient.
In order to have a flexible array member in a union or alone
in a struct, it needs to be wrapped in an anonymous struct
with at least 1 named member, but that member can be empty.
This was wrapped in Linux with the DECLARE_FLEX_ARRAY() macro.
This patch also work-arounds SWIG limitations with flexible arrays.
Test-Parameters: optional mdtcount=4 mdscount=2 \
clientdistro=ubuntu2404 testgroup=full-dne-part-1
Test-Parameters: optional mdtcount=4 mdscount=2 \
clientdistro=ubuntu2404 testgroup=full-dne-part-2
Test-Parameters: optional mdtcount=4 mdscount=2 \
clientdistro=ubuntu2404 testgroup=full-dne-part-3
Change-Id: I873663373332d63fb79137163149d42663f34705
Signed-off-by: Jian Yu <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56077
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Bruno Faccini <bfaccini@nvidia.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>