Whamcloud - gitweb
LU-17794 lustre: replace 0-length arrays with flexible arrays (2/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.
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: I833bea287764005bd4b09cd2a6a008f527f897b3
Signed-off-by: Jian Yu <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55940
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Li Xi <lixi@ddn.com>
Reviewed-by: jsimmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
16 files changed: