Whamcloud - gitweb
LU-17794 lustre: replace 0-length arrays with flexible arrays (2/3) 40/55940/5
authorJian Yu <yujian@whamcloud.com>
Tue, 6 Aug 2024 16:42:45 +0000 (09:42 -0700)
committerOleg Drokin <green@whamcloud.com>
Fri, 23 Aug 2024 22:02:04 +0000 (22:02 +0000)
commit4920a934baf06a81157df90abb08225517352479
tree021781d4236805dd871adccbe6877719c11aa5b0
parenta7c1481454f1bcb79dca010195648006e59fd2d3
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:
lnet/include/lnet/socklnd.h
lnet/klnds/kfilnd/kfilnd.h
lnet/klnds/o2iblnd/o2iblnd-idl.h
lnet/klnds/o2iblnd/o2iblnd.c
lustre/doc/llapi_file_get_stripe.3
lustre/doc/llapi_hsm_copytool_register.3
lustre/include/lustre_export.h
lustre/include/uapi/linux/lustre/lgss.h
lustre/include/uapi/linux/lustre/lustre_idl.h
lustre/include/uapi/linux/lustre/lustre_kernelcomm.h
lustre/include/uapi/linux/lustre/lustre_user.h
lustre/obdclass/llog_swab.c
lustre/osp/osp_internal.h
lustre/ptlrpc/wiretest.c
lustre/utils/wirecheck.c
lustre/utils/wiretest.c