From: Jian Yu Date: Tue, 6 Aug 2024 10:26:45 +0000 (-0700) Subject: LU-17794 lustre: replace 0-length arrays with flexible arrays (1/3) X-Git-Tag: 2.15.90~54 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=51a281cdb405fec311f280cfabc156c8746e2412;p=fs%2Flustre-release.git LU-17794 lustre: replace 0-length arrays with flexible arrays (1/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: I0e23a92382686678951f5d0dc56d91c895af7817 Signed-off-by: Jian Yu Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55874 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Li Xi Reviewed-by: jsimmons Reviewed-by: Oleg Drokin --- diff --git a/libcfs/include/libcfs/libcfs_hash.h b/libcfs/include/libcfs/libcfs_hash.h index 6fe31a6..5d5e998 100644 --- a/libcfs/include/libcfs/libcfs_hash.h +++ b/libcfs/include/libcfs/libcfs_hash.h @@ -79,7 +79,7 @@ struct cfs_hash_bucket { __u32 hsb_version; /**< change version */ unsigned int hsb_index; /**< index of bucket */ int hsb_depmax; /**< max depth on bucket */ - long hsb_head[0]; /**< hash-head array */ + long hsb_head[]; /**< hash-head array */ }; /** diff --git a/lnet/include/lnet/lib-types.h b/lnet/include/lnet/lib-types.h index 74bf050..2eea235 100644 --- a/lnet/include/lnet/lib-types.h +++ b/lnet/include/lnet/lib-types.h @@ -1712,7 +1712,7 @@ struct lnet_rtrbufpool { struct lnet_rtrbuf { struct list_head rb_list; /* chain on rbp_bufs */ struct lnet_rtrbufpool *rb_pool; /* owning pool */ - struct bio_vec rb_kiov[0]; /* the buffer space */ + struct bio_vec rb_kiov[]; /* the buffer space */ }; #define LNET_PEER_HASHSIZE 503 /* prime! */ @@ -1799,7 +1799,7 @@ struct lnet_portal { /* # active entries for this portal */ int ptl_mt_nmaps; /* array of active entries' cpu-partition-id */ - int ptl_mt_maps[0]; + int ptl_mt_maps[]; }; #define LNET_LH_HASH_BITS 12 diff --git a/lnet/include/uapi/linux/lnet/libcfs_ioctl.h b/lnet/include/uapi/linux/lnet/libcfs_ioctl.h index 0179e3e6..10c97c2 100644 --- a/lnet/include/uapi/linux/lnet/libcfs_ioctl.h +++ b/lnet/include/uapi/linux/lnet/libcfs_ioctl.h @@ -57,7 +57,7 @@ struct libcfs_ioctl_data { __u32 ioc_plen2; /* buffers in userspace */ void __user *ioc_pbuf2; - char ioc_bulk[0]; + char ioc_bulk[]; }; #define IOCTL_LIBCFS_TYPE long diff --git a/lnet/include/uapi/linux/lnet/lnetst.h b/lnet/include/uapi/linux/lnet/lnetst.h index 0e8a105..5bee8b0 100644 --- a/lnet/include/uapi/linux/lnet/lnetst.h +++ b/lnet/include/uapi/linux/lnet/lnetst.h @@ -126,7 +126,7 @@ struct lstcon_rpc_ent { struct lst_sid rpe_sid; /* peer's session id */ int rpe_fwk_errno; /* framework errno */ int rpe_priv[4]; /* private data */ - char rpe_payload[0]; /* private reply payload */ + char rpe_payload[]; /* private reply payload */ }; struct lstcon_trans_stat { diff --git a/lnet/klnds/o2iblnd/o2iblnd.h b/lnet/klnds/o2iblnd/o2iblnd.h index 3c99cf9..92c95ea 100644 --- a/lnet/klnds/o2iblnd/o2iblnd.h +++ b/lnet/klnds/o2iblnd/o2iblnd.h @@ -240,8 +240,8 @@ struct kib_hca_dev { #define IBLND_POOL_RETRY 1 struct kib_pages { - int ibp_npages; /* # pages */ - struct page *ibp_pages[0]; /* page array */ + int ibp_npages; /* # pages */ + struct page *ibp_pages[]; /* page array */ }; struct kib_pool; diff --git a/lnet/klnds/socklnd/socklnd.h b/lnet/klnds/socklnd/socklnd.h index 76544fa..0e3894d 100644 --- a/lnet/klnds/socklnd/socklnd.h +++ b/lnet/klnds/socklnd/socklnd.h @@ -273,7 +273,7 @@ struct ksock_tx { /* transmit packet */ int tx_desc_size; /* size of this descriptor */ enum lnet_msg_hstatus tx_hstatus; /* health status of tx */ struct kvec tx_hdr; /* virt hdr */ - struct bio_vec tx_payload[0]; /* paged payload */ + struct bio_vec tx_payload[]; /* paged payload */ }; #define KSOCK_NOOP_TX_SIZE ((int)offsetof(struct ksock_tx, tx_payload[0])) diff --git a/lnet/lnet/lib-cpt.c b/lnet/lnet/lib-cpt.c index a922b37..6d026c7 100644 --- a/lnet/lnet/lib-cpt.c +++ b/lnet/lnet/lib-cpt.c @@ -1114,7 +1114,7 @@ struct cfs_var_array { unsigned int va_count; /* # of buffers */ unsigned int va_size; /* size of each var */ struct cfs_cpt_table *va_cptab; /* cpu partition table */ - void *va_ptrs[0]; /* buffer addresses */ + void *va_ptrs[]; /* buffer addresses */ }; /* free per-cpu data, see more detail in cfs_percpt_free */ diff --git a/lnet/selftest/console.h b/lnet/selftest/console.h index 6cde58f..158d682 100644 --- a/lnet/selftest/console.h +++ b/lnet/selftest/console.h @@ -52,7 +52,7 @@ struct lstcon_group { struct list_head grp_trans_list; /* transaction list */ struct list_head grp_ndl_list; /* nodes list */ - struct list_head grp_ndl_hash[0];/* hash table for nodes */ + struct list_head grp_ndl_hash[]; /* hash table for nodes */ }; #define LST_BATCH_IDLE 0xB0 /* idle batch */ @@ -112,7 +112,7 @@ struct lstcon_test { struct lstcon_group *tes_src_grp; /* group run the test */ struct lstcon_group *tes_dst_grp; /* target group */ int tes_paramlen; /* test parameter length */ - char tes_param[0]; /* test parameter */ + char tes_param[]; /* test parameter */ }; #define LST_GLOBAL_HASHSIZE 503 /* global nodes hash table size */ diff --git a/lnet/selftest/selftest.h b/lnet/selftest/selftest.h index af42128..05788cc 100644 --- a/lnet/selftest/selftest.h +++ b/lnet/selftest/selftest.h @@ -217,7 +217,7 @@ struct srpc_bulk { int bk_sink; /* sink/source */ int bk_alloc; /* # allocated iov */ int bk_niov; /* # iov in bk_iovs */ - struct bio_vec bk_iovs[0]; + struct bio_vec bk_iovs[]; }; /* message buffer descriptor */ diff --git a/lnet/utils/lst.c b/lnet/utils/lst.c index c767730..71a6d7c 100644 --- a/lnet/utils/lst.c +++ b/lnet/utils/lst.c @@ -52,7 +52,7 @@ static struct lstcon_trans_stat trans_stat; typedef struct list_string { struct list_string *lstr_next; int lstr_sz; - char lstr_str[0]; + char lstr_str[]; } lstr_t; #ifndef offsetof diff --git a/lustre/doc/llapi_heat_get.3 b/lustre/doc/llapi_heat_get.3 index 840d639..7b0cda7 100644 --- a/lustre/doc/llapi_heat_get.3 +++ b/lustre/doc/llapi_heat_get.3 @@ -25,7 +25,7 @@ data structure, which contains the following fields: struct lu_heat { __u32 lh_heat_count; __u32 lh_padding1; - __u64 lh_heat[0]; + __u64 lh_heat[]; }; .fi The function diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index 572564ab..e3a678f 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -174,7 +174,7 @@ struct lprocfs_counter { }; struct lprocfs_percpu { - struct lprocfs_counter lp_cntr[0]; + DECLARE_FLEX_ARRAY(struct lprocfs_counter, lp_cntr); }; enum lprocfs_stats_lock_ops { @@ -211,7 +211,7 @@ struct lprocfs_stats { /* has ls_num of counter headers */ struct lprocfs_counter_header *ls_cnt_header; - struct lprocfs_percpu *ls_percpu[0]; + struct lprocfs_percpu *ls_percpu[]; }; #define OPC_RANGE(seg) (seg ## _LAST_OPC - seg ## _FIRST_OPC) diff --git a/lustre/include/lustre/libiam.h b/lustre/include/lustre/libiam.h index 39b6224..5b9cf2b 100644 --- a/lustre/include/lustre/libiam.h +++ b/lustre/include/lustre/libiam.h @@ -70,7 +70,7 @@ struct iam_lfix_root { struct dx_countlimit limit; u_int32_t idle_blocks; u_int8_t ilr_paddingdd2[12]; - unsigned char entries[0]; + unsigned char entries[]; } __attribute__((packed)); struct iam_leaf_head { @@ -90,13 +90,13 @@ struct iam_idle_head { __le16 iih_magic; __le16 iih_count; /* how many idle blocks in this head */ __le32 iih_next; /* next head for idle blocks */ - __le32 iih_blks[0]; + __le32 iih_blks[]; } __attribute__((packed)); struct iam_index_head { struct dx_countlimit limit; u_int8_t paddingdd[16]; - unsigned char entries[0]; + unsigned char entries[]; } __attribute__((packed)); struct lvar_root { @@ -112,7 +112,7 @@ struct lvar_root { struct lvar_leaf_entry { u_int32_t vle_hash; u_int16_t vle_keysize; - u_int8_t vle_key[0]; + u_int8_t vle_key[]; } __attribute__((packed)); struct osd_inode_id { diff --git a/lustre/include/lustre/lustreapi.h b/lustre/include/lustre/lustreapi.h index 13c4061..a155950 100644 --- a/lustre/include/lustre/lustreapi.h +++ b/lustre/include/lustre/lustreapi.h @@ -153,7 +153,7 @@ struct llapi_stripe_param { bool lsp_is_create; __u8 lsp_max_inherit; __u8 lsp_max_inherit_rr; - __u32 lsp_osts[0]; + __u32 lsp_osts[]; }; #define lsp_tgts lsp_osts diff --git a/lustre/include/lustre_dlm.h b/lustre/include/lustre_dlm.h index 3214c6f..2a44221 100644 --- a/lustre/include/lustre_dlm.h +++ b/lustre/include/lustre_dlm.h @@ -1089,7 +1089,7 @@ struct lustre_handle_array { unsigned int ha_count; /* ha_map is used as bit flag to indicate handle is remote or local */ DECLARE_BITMAP(ha_map, LMV_MAX_STRIPE_COUNT); - struct lustre_handle ha_handles[0]; + struct lustre_handle ha_handles[]; }; /** diff --git a/lustre/include/lustre_lmv.h b/lustre/include/lustre_lmv.h index a323dd7..a571301 100644 --- a/lustre/include/lustre_lmv.h +++ b/lustre/include/lustre_lmv.h @@ -51,7 +51,7 @@ struct lmv_stripe_md { __u32 lsm_md_migrate_offset; __u32 lsm_md_migrate_hash; char lsm_md_pool_name[LOV_MAXPOOLNAME + 1]; - struct lmv_oinfo lsm_md_oinfo[0]; + struct lmv_oinfo lsm_md_oinfo[]; }; struct lmv_stripe_object { diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h index a196c05..e70efb1 100644 --- a/lustre/include/lustre_net.h +++ b/lustre/include/lustre_net.h @@ -1673,7 +1673,7 @@ struct ptlrpc_service { /** * partition data for ptlrpc service */ - struct ptlrpc_service_part *srv_parts[0]; + struct ptlrpc_service_part *srv_parts[]; }; /** diff --git a/lustre/include/lustre_scrub.h b/lustre/include/lustre_scrub.h index 001c50e..d8230ca 100644 --- a/lustre/include/lustre_scrub.h +++ b/lustre/include/lustre_scrub.h @@ -227,7 +227,7 @@ struct lustre_index_restore_unit { struct lu_fid liru_cfid; __u64 liru_clid; int liru_len; - char liru_name[0]; + char liru_name[]; }; void scrub_file_init(struct lustre_scrub *scrub, guid_t uuid); diff --git a/lustre/include/lustre_sec.h b/lustre/include/lustre_sec.h index 7e44b26..0039317 100644 --- a/lustre/include/lustre_sec.h +++ b/lustre/include/lustre_sec.h @@ -916,7 +916,7 @@ struct ptlrpc_user_desc { __u32 pud_fsgid; __u32 pud_cap; __u32 pud_ngroups; - __u32 pud_groups[0]; + __u32 pud_groups[]; }; /* @@ -947,7 +947,7 @@ struct ptlrpc_bulk_sec_desc { __u8 bsd_svc; /* SPTLRPC_BULK_SVC_XXXX */ __u8 bsd_flags; /* flags */ __u32 bsd_nob; /* nob of bulk data */ - __u8 bsd_data[0]; /* policy-specific token */ + __u8 bsd_data[]; /* policy-specific token */ }; extern struct dentry *sptlrpc_debugfs_dir; diff --git a/lustre/include/uapi/linux/lustre/lustre_cfg.h b/lustre/include/uapi/linux/lustre/lustre_cfg.h index 2dcb57a..4a50600 100644 --- a/lustre/include/uapi/linux/lustre/lustre_cfg.h +++ b/lustre/include/uapi/linux/lustre/lustre_cfg.h @@ -160,7 +160,7 @@ struct lustre_cfg { __u32 lcfg_nal; /* not used any more */ __u32 lcfg_bufcount; - __u32 lcfg_buflens[0]; + __u32 lcfg_buflens[]; }; struct lcfg_type_data { diff --git a/lustre/include/uapi/linux/lustre/lustre_idl.h b/lustre/include/uapi/linux/lustre/lustre_idl.h index d963e4e..b68389d 100644 --- a/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -155,7 +155,7 @@ struct lu_seq_range { struct lu_seq_range_array { __u32 lsra_count; __u32 lsra_padding; - struct lu_seq_range lsra_lsr[0]; + struct lu_seq_range lsra_lsr[]; }; #define LU_SEQ_RANGE_MDT 0x0 @@ -644,7 +644,7 @@ struct lustre_msg_v2 { * message buffers are packed after padded lm_buflens[] array, * padded to a multiple of 8 bytes each to align contents. */ - __u32 lm_buflens[0]; + __u32 lm_buflens[]; }; /* The returned result of the SUB request in a batch request */ @@ -2345,7 +2345,7 @@ struct lmv_mds_md_v1 { __u32 lmv_padding2; __u64 lmv_padding3; char lmv_pool_name[LOV_MAXPOOLNAME + 1]; /* pool name */ - struct lu_fid lmv_stripe_fids[0]; /* FIDs for each stripe */ + struct lu_fid lmv_stripe_fids[]; /* FIDs for each stripe */ }; /* stripe count before directory split */ @@ -2742,8 +2742,8 @@ struct mgs_nidtbl_entry { __u8 mne_nid_size; /* size of each NID, by bytes */ __u8 mne_nid_count; /* # of NIDs in buffer */ union { - lnet_nid_t nids[0]; /* variable size buffer for NIDs. */ - struct lnet_nid nidlist[0]; + DECLARE_FLEX_ARRAY(lnet_nid_t, nids); /* variable size buffer for NIDs. */ + DECLARE_FLEX_ARRAY(struct lnet_nid, nidlist); } u; }; @@ -3456,7 +3456,7 @@ struct getparent { struct lu_fid gp_fid; /**< parent FID */ __u32 gp_linkno; /**< hardlink number */ __u32 gp_name_size; /**< size of the name field */ - char gp_name[0]; /**< zero-terminated link name */ + char gp_name[]; /**< zero-terminated link name */ } __attribute__((packed)); enum layout_intent_opc { @@ -3649,7 +3649,7 @@ struct batch_update_request { * it can locate the next request message via the function * @batch_update_reqmsg_next() in lustre/include/obj_update.h */ - struct lustre_msg burq_reqmsg[0]; + struct lustre_msg burq_reqmsg[]; }; #define BUT_HEADER_MAGIC 0xBADF0001 @@ -3674,7 +3674,7 @@ struct but_update_header { /* Unused padding field. */ __u32 buh_padding; /* Inline buffer used when the RPC request can be packed inline. */ - __u32 buh_inline_data[0]; + __u32 buh_inline_data[]; }; struct but_update_buffer { @@ -3696,7 +3696,7 @@ struct batch_update_reply { * It can locate the next reply message buffer via the function * @batch_update_repmsg_next() in lustre/include/obj_update.h */ - struct lustre_msg burp_repmsg[0]; + struct lustre_msg burp_repmsg[]; }; /** diff --git a/lustre/include/uapi/linux/lustre/lustre_user.h b/lustre/include/uapi/linux/lustre/lustre_user.h index 15be589..0f1262a 100644 --- a/lustre/include/uapi/linux/lustre/lustre_user.h +++ b/lustre/include/uapi/linux/lustre/lustre_user.h @@ -1507,7 +1507,7 @@ struct identity_downcall_data { __u32 idd_nperms; __u32 idd_ngroups; struct perm_downcall_data idd_perms[N_PERMS_MAX]; - __u32 idd_groups[0]; + __u32 idd_groups[]; }; #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 16, 53, 0) @@ -1517,7 +1517,7 @@ struct sepol_downcall_data_old { __u32 sdd_magic; __s64 sdd_sepol_mtime; __u16 sdd_sepol_len; - char sdd_sepol[0]; + char sdd_sepol[]; }; #endif @@ -1527,7 +1527,7 @@ struct sepol_downcall_data { __u16 sdd_sepol_len; __u16 sdd_padding1; __s64 sdd_sepol_mtime; - char sdd_sepol[0]; + char sdd_sepol[]; }; #ifdef NEED_QUOTA_DEFS @@ -2918,7 +2918,7 @@ enum obd_heat_type { struct lu_heat { __u32 lh_count; __u32 lh_flags; - __u64 lh_heat[0]; + __u64 lh_heat[]; }; enum lu_pcc_type { @@ -3061,7 +3061,7 @@ struct fid_array { /* make header's size equal lu_fid */ __u32 fa_padding0; __u64 fa_padding1; - struct lu_fid fa_fids[0]; + struct lu_fid fa_fids[]; }; #define OBD_MAX_FIDS_IN_ARRAY 4096 diff --git a/lustre/lfsck/lfsck_internal.h b/lustre/lfsck/lfsck_internal.h index bb82522..c674d16 100644 --- a/lustre/lfsck/lfsck_internal.h +++ b/lustre/lfsck/lfsck_internal.h @@ -352,7 +352,7 @@ struct lfsck_layout { u64 ll_reserved_2[7]; /* OST target bitmap to record OSTs that contain non-verified OST-obj */ - __u8 ll_ost_bitmap[0]; + __u8 ll_ost_bitmap[]; }; struct lfsck_assistant_object { diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index 008ddbd..99b7360 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -2921,7 +2921,7 @@ struct lmv_dir_ctxt { struct md_readdir_info *ldc_mrinfo; __u64 ldc_hash; int ldc_count; - struct stripe_dirent ldc_stripes[0]; + struct stripe_dirent ldc_stripes[]; }; static inline void stripe_dirent_unload(struct stripe_dirent *stripe) diff --git a/lustre/lov/lov_cl_internal.h b/lustre/lov/lov_cl_internal.h index 9bccabc..33bb43d 100644 --- a/lustre/lov/lov_cl_internal.h +++ b/lustre/lov/lov_cl_internal.h @@ -423,7 +423,7 @@ struct lov_lock { /* Number of sub-locks in this lock */ int lls_nr; /* sublock array */ - struct lov_lock_sub lls_sub[0]; + struct lov_lock_sub lls_sub[]; }; /* Bottom half. */ diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index 9dfb114..6c7be7a 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -4986,7 +4986,7 @@ struct mgs_lcfg_fork_data { struct llog_handle *mlfd_llh; const char *mlfd_oldname; const char *mlfd_newname; - char mlfd_data[0]; + char mlfd_data[]; }; static bool contain_valid_fsname(char *buf, const char *fsname, diff --git a/lustre/obdclass/kernelcomm.c b/lustre/obdclass/kernelcomm.c index c08c85c..64cb167 100644 --- a/lustre/obdclass/kernelcomm.c +++ b/lustre/obdclass/kernelcomm.c @@ -367,7 +367,7 @@ struct kkuc_reg { struct obd_uuid kr_uuid; int kr_uid; struct file *kr_fp; - char kr_data[0]; + char kr_data[]; }; static struct list_head kkuc_groups[KUC_GRP_MAX + 1]; diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 1c0cca0..78d5167 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -1545,7 +1545,7 @@ struct osd_xattr_entry { size_t oxe_namelen; bool oxe_exist; struct rcu_head oxe_rcu; - char oxe_buf[0]; + char oxe_buf[]; }; static int osd_oxc_get(struct osd_object *obj, const char *name, diff --git a/lustre/osd-ldiskfs/osd_iam.h b/lustre/osd-ldiskfs/osd_iam.h index 92505d8..d620f97 100644 --- a/lustre/osd-ldiskfs/osd_iam.h +++ b/lustre/osd-ldiskfs/osd_iam.h @@ -430,7 +430,7 @@ struct iam_idle_head { __le16 iih_magic; __le16 iih_count; /* how many idle blocks in this head */ __le32 iih_next; /* next head for idle blocks */ - __le32 iih_blks[0]; + __le32 iih_blks[]; }; /* diff --git a/lustre/osd-ldiskfs/osd_iam_lvar.c b/lustre/osd-ldiskfs/osd_iam_lvar.c index f3d03cd..77a9343 100644 --- a/lustre/osd-ldiskfs/osd_iam_lvar.c +++ b/lustre/osd-ldiskfs/osd_iam_lvar.c @@ -46,7 +46,7 @@ typedef u32 lvar_hash_t; struct lvar_leaf_entry { __le32 vle_hash; __le16 vle_keysize; - u8 vle_key[0]; + u8 vle_key[]; }; #define PDIFF(ptr0, ptr1) (((char *)(ptr0)) - ((char *)(ptr1))) diff --git a/lustre/ptlrpc/gss/gss_krb5.h b/lustre/ptlrpc/gss/gss_krb5.h index 6111604..6590a62 100644 --- a/lustre/ptlrpc/gss/gss_krb5.h +++ b/lustre/ptlrpc/gss/gss_krb5.h @@ -66,13 +66,13 @@ #define FLAG_ACCEPTOR_SUBKEY 0x04 struct krb5_header { - __u16 kh_tok_id; /* token id */ - __u8 kh_flags; /* acceptor flags */ - __u8 kh_filler; /* 0xff */ - __u16 kh_ec; /* extra count */ - __u16 kh_rrc; /* right rotation count */ - __u64 kh_seq; /* sequence number */ - __u8 kh_cksum[0]; /* checksum */ + __u16 kh_tok_id; /* token id */ + __u8 kh_flags; /* acceptor flags */ + __u8 kh_filler; /* 0xff */ + __u16 kh_ec; /* extra count */ + __u16 kh_rrc; /* right rotation count */ + __u64 kh_seq; /* sequence number */ + __u8 kh_cksum[]; /* checksum */ }; struct krb5_ctx { diff --git a/lustre/ptlrpc/ptlrpcd.c b/lustre/ptlrpc/ptlrpcd.c index e452152..78e3f6a 100644 --- a/lustre/ptlrpc/ptlrpcd.c +++ b/lustre/ptlrpc/ptlrpcd.c @@ -71,7 +71,7 @@ struct ptlrpcd { int pd_cursor; int pd_nthreads; int pd_groupsize; - struct ptlrpcd_ctl pd_threads[0]; + struct ptlrpcd_ctl pd_threads[]; }; /* diff --git a/lustre/tests/check_fhandle_syscalls.c b/lustre/tests/check_fhandle_syscalls.c index 2fdd124..b8642c9 100644 --- a/lustre/tests/check_fhandle_syscalls.c +++ b/lustre/tests/check_fhandle_syscalls.c @@ -64,7 +64,7 @@ struct file_handle { __u32 handle_bytes; int handle_type; /* file identifier */ - unsigned char f_handle[0]; + unsigned char f_handle[]; }; #if defined(_ASM_X86_UNISTD_64_H) diff --git a/lustre/utils/liblustreapi_chlg.c b/lustre/utils/liblustreapi_chlg.c index 31b291c..ce1727e 100644 --- a/lustre/utils/liblustreapi_chlg.c +++ b/lustre/utils/liblustreapi_chlg.c @@ -77,7 +77,7 @@ struct changelog_private { /* Current position in buffer */ char *clp_buf_pos; /* Read buffer with records read from system */ - char clp_buf[0]; + char clp_buf[]; }; /** diff --git a/lustre/utils/lsnapshot.c b/lustre/utils/lsnapshot.c index 7dacf66..2d93176 100644 --- a/lustre/utils/lsnapshot.c +++ b/lustre/utils/lsnapshot.c @@ -2169,7 +2169,7 @@ static int snapshot_list_all(struct snapshot_instance *si) struct snapshot_target *st = si->si_mdt0; struct list_sub_item { struct list_head lsi_list; - char lsi_ssname[0]; + char lsi_ssname[]; }; struct list_head list_sub_items; diff --git a/lustre/utils/mount_utils.c b/lustre/utils/mount_utils.c index cbe2c5f..1c41f359 100644 --- a/lustre/utils/mount_utils.c +++ b/lustre/utils/mount_utils.c @@ -1063,7 +1063,7 @@ out_bad_mnt_str: #ifdef HAVE_SERVER_SUPPORT struct lustre_cfg_entry { struct list_head lce_list; - char lce_name[0]; + char lce_name[]; }; static struct lustre_cfg_entry *lustre_cfg_entry_init(const char *name)