Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

treewide: Replace zero-length arrays with flexible-array members

There is a regular need in the kernel to provide a way to declare
having a dynamically sized set of trailing elements in a structure.
Kernel code should always use “flexible array members”[1] for these
cases. The older style of one-element or zero-length arrays should
no longer be used[2].

This code was transformed with the help of Coccinelle:
(next-20220214$ spatch --jobs $(getconf _NPROCESSORS_ONLN) --sp-file script.cocci --include-headers --dir . > output.patch)

@@
identifier S, member, array;
type T1, T2;
@@

struct S {
...
T1 member;
T2 array[
- 0
];
};

UAPI and wireless changes were intentionally excluded from this patch
and will be sent out separately.

[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arrays

Link: https://github.com/KSPP/linux/issues/78
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>

+111 -111
+1 -1
arch/alpha/include/asm/hwrpb.h
··· 152 152 unsigned long chksum; 153 153 unsigned long optional_pa; 154 154 unsigned long numclusters; 155 - struct memclust_struct cluster[0]; 155 + struct memclust_struct cluster[]; 156 156 }; 157 157 158 158 struct dsr_struct {
+1 -1
arch/ia64/include/asm/sal.h
··· 420 420 * The rest of this structure consists of variable-length arrays, which can't be 421 421 * expressed in C. 422 422 */ 423 - sal_log_mod_error_info_t info[0]; 423 + sal_log_mod_error_info_t info[]; 424 424 /* 425 425 * This is what the rest looked like if C supported variable-length arrays: 426 426 *
+1 -1
arch/s390/include/asm/ccwgroup.h
··· 25 25 unsigned int count; 26 26 struct device dev; 27 27 struct work_struct ungroup_work; 28 - struct ccw_device *cdev[0]; 28 + struct ccw_device *cdev[]; 29 29 }; 30 30 31 31 /**
+1 -1
arch/s390/include/asm/chsc.h
··· 63 63 struct chsc_header response; 64 64 u32:32; 65 65 struct chsc_pnso_naihdr naihdr; 66 - struct chsc_pnso_naid_l2 entries[0]; 66 + struct chsc_pnso_naid_l2 entries[]; 67 67 } __packed __aligned(PAGE_SIZE); 68 68 69 69 #endif /* _ASM_S390_CHSC_H */
+1 -1
arch/s390/include/asm/eadm.h
··· 78 78 79 79 struct aob_rq_header { 80 80 struct scm_device *scmdev; 81 - char data[0]; 81 + char data[]; 82 82 }; 83 83 84 84 struct scm_device {
+2 -2
arch/s390/include/asm/fcx.h
··· 214 214 u32 :32; 215 215 u64 time; 216 216 u64 prog_id; 217 - u8 prog_data[0]; 217 + u8 prog_data[]; 218 218 } __attribute__ ((packed)); 219 219 220 220 #define DCW_FLAGS_CC (1 << (7 - 1)) ··· 241 241 u32 :8; 242 242 u32 cd_count:8; 243 243 u32 count; 244 - u8 cd[0]; 244 + u8 cd[]; 245 245 } __attribute__ ((packed)); 246 246 247 247 #define TCCB_FORMAT_DEFAULT 0x7f
+1 -1
arch/s390/include/asm/idals.h
··· 108 108 struct idal_buffer { 109 109 size_t size; 110 110 size_t page_order; 111 - void *data[0]; 111 + void *data[]; 112 112 }; 113 113 114 114 /*
+1 -1
arch/s390/include/asm/sclp.h
··· 112 112 * (OpenCrypto Successful Diagnostics Execution) 113 113 */ 114 114 u16 length; /* Length of Subsequent Data (up to 4K – SCLP header */ 115 - u8 data[0]; /* Subsequent Data passed verbatim to SCLP ET 24 */ 115 + u8 data[]; /* Subsequent Data passed verbatim to SCLP ET 24 */ 116 116 } __packed; 117 117 118 118 extern char *sclp_early_sccb;
+3 -3
arch/s390/include/asm/sysinfo.h
··· 67 67 unsigned short cpus_configured; 68 68 unsigned short cpus_standby; 69 69 unsigned short cpus_reserved; 70 - unsigned short adjustment[0]; 70 + unsigned short adjustment[]; 71 71 }; 72 72 73 73 struct sysinfo_1_2_2_extension { 74 74 unsigned int alt_capability; 75 - unsigned short alt_adjustment[0]; 75 + unsigned short alt_adjustment[]; 76 76 }; 77 77 78 78 struct sysinfo_2_2_1 { ··· 181 181 unsigned char reserved1; 182 182 unsigned char mnest; 183 183 unsigned char reserved2[4]; 184 - union topology_entry tle[0]; 184 + union topology_entry tle[]; 185 185 }; 186 186 187 187 int stsi(void *sysinfo, int fc, int sel1, int sel2);
+1 -1
arch/sh/include/asm/thread_info.h
··· 33 33 mm_segment_t addr_limit; /* thread address space */ 34 34 unsigned long previous_sp; /* sp of previous stack in case 35 35 of nested IRQ stacks */ 36 - __u8 supervisor_stack[0]; 36 + __u8 supervisor_stack[]; 37 37 }; 38 38 39 39 #endif
+5 -5
arch/sparc/include/asm/vio.h
··· 70 70 #define VIO_RX_DRING_DATA 0x0004 71 71 u16 resv; 72 72 u32 num_cookies; 73 - struct ldc_trans_cookie cookies[0]; 73 + struct ldc_trans_cookie cookies[]; 74 74 }; 75 75 76 76 struct vio_dring_unregister { ··· 161 161 u64 size; 162 162 u32 ncookies; 163 163 u32 resv2; 164 - struct ldc_trans_cookie cookies[0]; 164 + struct ldc_trans_cookie cookies[]; 165 165 }; 166 166 167 167 #define VIO_DISK_VNAME_LEN 8 ··· 200 200 u16 resv; 201 201 u16 type; 202 202 u32 len; 203 - char id[0]; 203 + char id[]; 204 204 }; 205 205 206 206 struct vio_disk_efi { 207 207 u64 lba; 208 208 u64 len; 209 - char data[0]; 209 + char data[]; 210 210 }; 211 211 212 212 /* VIO net specific structures and defines */ ··· 246 246 struct vio_dring_hdr hdr; 247 247 u32 size; 248 248 u32 ncookies; 249 - struct ldc_trans_cookie cookies[0]; 249 + struct ldc_trans_cookie cookies[]; 250 250 }; 251 251 252 252 struct vio_net_dext {
+1 -1
arch/um/include/shared/net_kern.h
··· 39 39 40 40 void (*add_address)(unsigned char *, unsigned char *, void *); 41 41 void (*delete_address)(unsigned char *, unsigned char *, void *); 42 - char user[0]; 42 + char user[]; 43 43 }; 44 44 45 45 struct net_kern_info {
+1 -1
arch/x86/include/asm/microcode_amd.h
··· 38 38 39 39 struct microcode_amd { 40 40 struct microcode_header_amd hdr; 41 - unsigned int mpb[0]; 41 + unsigned int mpb[]; 42 42 }; 43 43 44 44 #define PATCH_MAX_SIZE (3 * PAGE_SIZE)
+2 -2
arch/x86/include/asm/microcode_intel.h
··· 19 19 20 20 struct microcode_intel { 21 21 struct microcode_header_intel hdr; 22 - unsigned int bits[0]; 22 + unsigned int bits[]; 23 23 }; 24 24 25 25 /* microcode format is extended from prescott processors */ ··· 33 33 unsigned int count; 34 34 unsigned int cksum; 35 35 unsigned int reserved[3]; 36 - struct extended_signature sigs[0]; 36 + struct extended_signature sigs[]; 37 37 }; 38 38 39 39 #define DEFAULT_UCODE_DATASIZE (2000)
+1 -1
arch/x86/include/asm/pci.h
··· 135 135 unsigned long bus; 136 136 unsigned long device; 137 137 unsigned long function; 138 - uint8_t romdata[0]; 138 + uint8_t romdata[]; 139 139 }; 140 140 141 141 #endif /* _ASM_X86_PCI_H */
+1 -1
arch/x86/include/asm/pci_x86.h
··· 87 87 u32 miniport_data; /* Crap */ 88 88 u8 rfu[11]; 89 89 u8 checksum; /* Modulo 256 checksum must give 0 */ 90 - struct irq_info slots[0]; 90 + struct irq_info slots[]; 91 91 } __attribute__((packed)); 92 92 93 93 extern unsigned int pcibios_irq_mask;
+1 -1
arch/xtensa/include/asm/bootparam.h
··· 34 34 typedef struct bp_tag { 35 35 unsigned short id; /* tag id */ 36 36 unsigned short size; /* size of this record excluding the structure*/ 37 - unsigned long data[0]; /* data */ 37 + unsigned long data[]; /* data */ 38 38 } bp_tag_t; 39 39 40 40 struct bp_meminfo {
+1 -1
drivers/crypto/caam/pdb.h
··· 144 144 }; 145 145 u32 spi; 146 146 u32 ip_hdr_len; 147 - u32 ip_hdr[0]; 147 + u32 ip_hdr[]; 148 148 }; 149 149 150 150 /**
+1 -1
drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c
··· 51 51 struct guc_gt_system_info system_info; 52 52 struct guc_engine_usage engine_usage; 53 53 /* From here on, location is dynamic! Refer to above diagram. */ 54 - struct guc_mmio_reg regset[0]; 54 + struct guc_mmio_reg regset[]; 55 55 } __packed; 56 56 57 57 static u32 guc_ads_regset_size(struct intel_guc *guc)
+1 -1
drivers/gpu/drm/nouveau/include/nvfw/hs.h
··· 23 23 u32 data_dma_base; 24 24 u32 data_size; 25 25 u32 num_apps; 26 - u32 apps[0]; 26 + u32 apps[]; 27 27 }; 28 28 29 29 const struct nvfw_hs_load_header *
+1 -1
drivers/hwtracing/coresight/coresight-config.h
··· 231 231 bool enabled; 232 232 struct list_head node; 233 233 int nr_feat; 234 - struct cscfg_feature_csdev *feats_csdev[0]; 234 + struct cscfg_feature_csdev *feats_csdev[]; 235 235 }; 236 236 237 237 /**
+1 -1
drivers/misc/bcm-vk/bcm_vk.h
··· 311 311 u32 wr_idx; 312 312 u32 buf_size; 313 313 u32 mask; 314 - char data[0]; 314 + char data[]; 315 315 }; 316 316 317 317 /* max buf size allowed */
+3 -3
drivers/misc/habanalabs/include/common/cpucp_if.h
··· 540 540 struct cpucp_unmask_irq_arr_packet { 541 541 struct cpucp_packet cpucp_pkt; 542 542 __le32 length; 543 - __le32 irqs[0]; 543 + __le32 irqs[]; 544 544 }; 545 545 546 546 struct cpucp_nic_status_packet { 547 547 struct cpucp_packet cpucp_pkt; 548 548 __le32 length; 549 - __le32 data[0]; 549 + __le32 data[]; 550 550 }; 551 551 552 552 struct cpucp_array_data_packet { 553 553 struct cpucp_packet cpucp_pkt; 554 554 __le32 length; 555 - __le32 data[0]; 555 + __le32 data[]; 556 556 }; 557 557 558 558 enum cpucp_packet_rc {
+2 -2
drivers/misc/habanalabs/include/gaudi/gaudi_packets.h
··· 54 54 /* The rest of the packet data follows. Use the corresponding 55 55 * packet_XXX struct to deference the data, based on packet type 56 56 */ 57 - u8 contents[0]; 57 + u8 contents[]; 58 58 }; 59 59 60 60 struct packet_nop { ··· 75 75 struct packet_wreg_bulk { 76 76 __le32 size64; 77 77 __le32 ctl; 78 - __le64 values[0]; /* data starts here */ 78 + __le64 values[]; /* data starts here */ 79 79 }; 80 80 81 81 #define GAUDI_PKT_LONG_CTL_OP_SHIFT 20
+2 -2
drivers/misc/habanalabs/include/goya/goya_packets.h
··· 62 62 /* The rest of the packet data follows. Use the corresponding 63 63 * packet_XXX struct to deference the data, based on packet type 64 64 */ 65 - u8 contents[0]; 65 + u8 contents[]; 66 66 }; 67 67 68 68 struct packet_nop { ··· 86 86 struct packet_wreg_bulk { 87 87 __le32 size64; 88 88 __le32 ctl; 89 - __le64 values[0]; /* data starts here */ 89 + __le64 values[]; /* data starts here */ 90 90 }; 91 91 92 92 struct packet_msg_long {
+1 -1
drivers/net/ethernet/freescale/enetc/enetc_hw.h
··· 881 881 u32 bth; 882 882 u32 ct; 883 883 u32 cte; 884 - struct sgce sgcl[0]; 884 + struct sgce sgcl[]; 885 885 }; 886 886 887 887 #define ENETC_CBDR_FMI_MR BIT(0)
+1 -1
drivers/net/ethernet/i825xx/sun3_82586.h
··· 250 250 unsigned short cmd_cmd; 251 251 unsigned short cmd_link; 252 252 unsigned short mc_cnt; /* number of bytes in the MC-List */ 253 - unsigned char mc_list[0][6]; /* pointer to 6 bytes entries */ 253 + unsigned char mc_list[][6]; /* pointer to 6 bytes entries */ 254 254 }; 255 255 256 256 /*
+3 -3
drivers/net/ethernet/marvell/octeontx2/af/npc.h
··· 455 455 u8 name[NPC_NAME_LEN]; /* KPU Profile name */ 456 456 u64 version; /* KPU firmware/profile version */ 457 457 u8 num_prfl; /* No of NPC profiles. */ 458 - u16 prfl_sz[0]; 458 + u16 prfl_sz[]; 459 459 }; 460 460 461 461 struct npc_mcam_kex { ··· 482 482 * struct npc_kpu_profile_cam[entries]; 483 483 * struct npc_kpu_profile_action[entries]; 484 484 */ 485 - u8 data[0]; 485 + u8 data[]; 486 486 } __packed; 487 487 488 488 struct npc_lt_def { ··· 572 572 * Custom KPU CAM and ACTION configuration entries. 573 573 * struct npc_kpu_fwdata kpu[kpus]; 574 574 */ 575 - u8 data[0]; 575 + u8 data[]; 576 576 } __packed; 577 577 578 578 struct rvu_npc_mcam_rule {
+1 -1
drivers/net/ethernet/qlogic/qed/qed_mfw_hsi.h
··· 2470 2470 u32 version; 2471 2471 #define NVM_META_BIN_VERSION 1 2472 2472 u32 num_options; 2473 - u32 options[0]; 2473 + u32 options[]; 2474 2474 }; 2475 2475 #endif
+1 -1
drivers/net/ethernet/ti/davinci_mdio.c
··· 70 70 #define USERACCESS_DATA (0xffff) 71 71 72 72 u32 physel; 73 - } user[0]; 73 + } user[]; 74 74 }; 75 75 76 76 static const struct mdio_platform_data default_pdata = {
+1 -1
drivers/scsi/dpt/dpti_i2o.h
··· 123 123 u32 change_ind; 124 124 u32 reserved2; 125 125 u32 reserved3; 126 - struct i2o_sys_tbl_entry iops[0]; 126 + struct i2o_sys_tbl_entry iops[]; 127 127 }; 128 128 129 129 /*
+10 -10
drivers/scsi/elx/libefc_sli/sli4.h
··· 609 609 __le16 cqe_count; 610 610 __le16 rsvd30; 611 611 __le32 rsvd32; 612 - struct sli4_dmaaddr page_phys_addr[0]; 612 + struct sli4_dmaaddr page_phys_addr[]; 613 613 }; 614 614 615 615 enum sli4_create_cqset_e { ··· 634 634 __le16 num_cq_req; 635 635 __le16 dw6w1_flags; 636 636 __le16 eq_id[16]; 637 - struct sli4_dmaaddr page_phys_addr[0]; 637 + struct sli4_dmaaddr page_phys_addr[]; 638 638 }; 639 639 640 640 /* CQE count */ ··· 764 764 __le32 dw7_val; 765 765 __le32 dw8_flags; 766 766 __le32 rsvd36; 767 - struct sli4_dmaaddr page_phys_addr[0]; 767 + struct sli4_dmaaddr page_phys_addr[]; 768 768 }; 769 769 770 770 struct sli4_rsp_cmn_create_mq_ext { ··· 802 802 __le32 dw6_flags; 803 803 __le32 rsvd28; 804 804 __le32 rsvd32; 805 - struct sli4_dmaaddr page_phys_addr[0]; 805 + struct sli4_dmaaddr page_phys_addr[]; 806 806 }; 807 807 808 808 enum sli4_create_rq_e { ··· 887 887 __le16 base_cq_id; 888 888 __le16 rsvd26; 889 889 __le32 rsvd42; 890 - struct sli4_dmaaddr page_phys_addr[0]; 890 + struct sli4_dmaaddr page_phys_addr[]; 891 891 }; 892 892 893 893 struct sli4_rsp_rq_create_v2 { ··· 3168 3168 __le32 read_offset; 3169 3169 u8 object_name[104]; 3170 3170 __le32 host_buffer_descriptor_count; 3171 - struct sli4_bde host_buffer_descriptor[0]; 3171 + struct sli4_bde host_buffer_descriptor[]; 3172 3172 }; 3173 3173 3174 3174 #define RSP_COM_READ_OBJ_EOF 0x80000000 ··· 3191 3191 __le32 write_offset; 3192 3192 u8 object_name[104]; 3193 3193 __le32 host_buffer_descriptor_count; 3194 - struct sli4_bde host_buffer_descriptor[0]; 3194 + struct sli4_bde host_buffer_descriptor[]; 3195 3195 }; 3196 3196 3197 3197 #define RSP_CHANGE_STATUS 0xff ··· 3217 3217 __le32 read_offset; 3218 3218 u8 object_name[104]; 3219 3219 __le32 host_buffer_descriptor_count; 3220 - struct sli4_bde host_buffer_descriptor[0]; 3220 + struct sli4_bde host_buffer_descriptor[]; 3221 3221 }; 3222 3222 3223 3223 enum sli4_rqst_set_dump_flags { ··· 3342 3342 u8 descriptor_type; 3343 3343 u8 descriptor_length; 3344 3344 __le16 rsvd16; 3345 - __le32 type_specific[0]; 3345 + __le32 type_specific[]; 3346 3346 }; 3347 3347 3348 3348 enum sli4_pcie_desc_flags { ··· 3474 3474 struct sli4_rqst_hdr hdr; 3475 3475 __le16 rpi_offset; 3476 3476 __le16 page_count; 3477 - struct sli4_dmaaddr page_descriptor[0]; 3477 + struct sli4_dmaaddr page_descriptor[]; 3478 3478 }; 3479 3479 3480 3480 #define SLI4_HDR_TEMPLATE_SIZE 64
+1 -1
drivers/scsi/mpi3mr/mpi3mr.h
··· 878 878 bool process_evt; 879 879 u32 evt_ctx; 880 880 struct kref ref_count; 881 - char event_data[0] __aligned(4); 881 + char event_data[] __aligned(4); 882 882 }; 883 883 884 884
+2 -2
drivers/scsi/qla2xxx/qla_bsg.h
··· 157 157 uint16_t rsrvd; 158 158 struct qla84_mgmt_param mgmtp;/* parameters for cmd */ 159 159 uint32_t len; /* bytes in payload following this struct */ 160 - uint8_t payload[0]; /* payload for cmd */ 160 + uint8_t payload[]; /* payload for cmd */ 161 161 }; 162 162 163 163 struct qla_bsg_a84_mgmt { ··· 216 216 217 217 struct qla_image_version_list { 218 218 uint32_t count; 219 - struct qla_image_version version[0]; 219 + struct qla_image_version version[]; 220 220 } __packed; 221 221 222 222 struct qla_status_reg {
+1 -1
drivers/scsi/qla2xxx/qla_def.h
··· 5410 5410 struct ql_vnd_stats { 5411 5411 u64 entry_count; /* Num of entries */ 5412 5412 u64 rservd; 5413 - struct ql_vnd_stat_entry entry[0]; /* Place holder of entries */ 5413 + struct ql_vnd_stat_entry entry[]; /* Place holder of entries */ 5414 5414 } __packed; 5415 5415 5416 5416 struct ql_vnd_host_stats_resp {
+2 -2
drivers/scsi/qla2xxx/qla_edif_bsg.h
··· 121 121 struct app_pinfo_reply { 122 122 uint8_t port_count; 123 123 uint8_t reserved[VND_CMD_APP_RESERVED_SIZE]; 124 - struct app_pinfo ports[0]; 124 + struct app_pinfo ports[]; 125 125 } __packed; 126 126 127 127 struct app_sinfo_req { ··· 140 140 141 141 struct app_stats_reply { 142 142 uint8_t elem_count; 143 - struct app_sinfo elem[0]; 143 + struct app_sinfo elem[]; 144 144 } __packed; 145 145 146 146 struct qla_sa_update_frame {
+1 -1
drivers/scsi/qla2xxx/qla_fw.h
··· 1706 1706 __le16 length; 1707 1707 __le16 checksum; 1708 1708 __le16 unused; 1709 - struct qla_flt_region region[0]; 1709 + struct qla_flt_region region[]; 1710 1710 }; 1711 1711 1712 1712 #define FLT_REGION_SIZE 16
+1 -1
drivers/scsi/qla4xxx/ql4_fw.h
··· 1028 1028 1029 1029 uint8_t out_RISC_reg_dump[256]; /* 80 -17F */ 1030 1030 uint8_t in_RISC_reg_dump[256]; /*180 -27F */ 1031 - uint8_t in_out_RISC_stack_dump[0]; /*280 - ??? */ 1031 + uint8_t in_out_RISC_stack_dump[]; /*280 - ??? */ 1032 1032 }; 1033 1033 1034 1034 struct conn_event_log_entry {
+5 -5
drivers/staging/r8188eu/include/rtw_cmd.h
··· 73 73 u8 id:4; 74 74 u8 plen:4; 75 75 u8 seq; 76 - u8 payload[0]; 76 + u8 payload[]; 77 77 }; 78 78 79 79 #define c2h_evt_exist(c2h_evt) ((c2h_evt)->id || (c2h_evt)->plen) ··· 662 662 struct setprobereqextraie_parm { 663 663 unsigned char e_id; 664 664 unsigned char ie_len; 665 - unsigned char ie[0]; 665 + unsigned char ie[]; 666 666 }; 667 667 668 668 struct setassocreqextraie_parm { 669 669 unsigned char e_id; 670 670 unsigned char ie_len; 671 - unsigned char ie[0]; 671 + unsigned char ie[]; 672 672 }; 673 673 674 674 struct setproberspextraie_parm { 675 675 unsigned char e_id; 676 676 unsigned char ie_len; 677 - unsigned char ie[0]; 677 + unsigned char ie[]; 678 678 }; 679 679 680 680 struct setassocrspextraie_parm { 681 681 unsigned char e_id; 682 682 unsigned char ie_len; 683 - unsigned char ie[0]; 683 + unsigned char ie[]; 684 684 }; 685 685 686 686 struct addBaReq_parm {
+4 -4
drivers/staging/rtl8712/rtl871x_cmd.h
··· 657 657 struct setprobereqextraie_parm { 658 658 unsigned char e_id; 659 659 unsigned char ie_len; 660 - unsigned char ie[0]; 660 + unsigned char ie[]; 661 661 }; 662 662 663 663 struct setassocreqextraie_parm { 664 664 unsigned char e_id; 665 665 unsigned char ie_len; 666 - unsigned char ie[0]; 666 + unsigned char ie[]; 667 667 }; 668 668 669 669 struct setproberspextraie_parm { 670 670 unsigned char e_id; 671 671 unsigned char ie_len; 672 - unsigned char ie[0]; 672 + unsigned char ie[]; 673 673 }; 674 674 675 675 struct setassocrspextraie_parm { 676 676 unsigned char e_id; 677 677 unsigned char ie_len; 678 - unsigned char ie[0]; 678 + unsigned char ie[]; 679 679 }; 680 680 681 681 struct addBaReq_parm {
+1 -1
drivers/staging/rtl8723bs/include/ieee80211.h
··· 204 204 struct ieee_param_ex { 205 205 u32 cmd; 206 206 u8 sta_addr[ETH_ALEN]; 207 - u8 data[0]; 207 + u8 data[]; 208 208 }; 209 209 210 210 struct sta_data {
+1 -1
drivers/staging/rtl8723bs/include/rtw_cmd.h
··· 94 94 u8 id:4; 95 95 u8 plen:4; 96 96 u8 seq; 97 - u8 payload[0]; 97 + u8 payload[]; 98 98 }; 99 99 100 100 struct c2h_evt_hdr_88xx {
+1 -1
drivers/staging/vc04_services/include/linux/raspberrypi/vchiq.h
··· 45 45 /* Size of message data. */ 46 46 unsigned int size; 47 47 48 - char data[0]; /* message */ 48 + char data[]; /* message */ 49 49 }; 50 50 51 51 struct vchiq_element {
+1 -1
drivers/visorbus/vbuschannel.h
··· 89 89 struct visor_vbus_headerinfo hdr_info; 90 90 struct visor_vbus_deviceinfo chp_info; 91 91 struct visor_vbus_deviceinfo bus_info; 92 - struct visor_vbus_deviceinfo dev_info[0]; 92 + struct visor_vbus_deviceinfo dev_info[]; 93 93 } __packed; 94 94 95 95 #endif
+1 -1
fs/cifs/ntlmssp.h
··· 107 107 SECURITY_BUFFER WorkstationName; /* RFC 1001 and ASCII */ 108 108 struct ntlmssp_version Version; 109 109 /* SECURITY_BUFFER */ 110 - char DomainString[0]; 110 + char DomainString[]; 111 111 /* followed by WorkstationString */ 112 112 } __packed; 113 113
+2 -2
fs/ext4/fast_commit.h
··· 55 55 struct ext4_fc_dentry_info { 56 56 __le32 fc_parent_ino; 57 57 __le32 fc_ino; 58 - __u8 fc_dname[0]; 58 + __u8 fc_dname[]; 59 59 }; 60 60 61 61 /* Value structure for EXT4_FC_TAG_INODE and EXT4_FC_TAG_INODE_PARTIAL. */ 62 62 struct ext4_fc_inode { 63 63 __le32 fc_ino; 64 - __u8 fc_raw_inode[0]; 64 + __u8 fc_raw_inode[]; 65 65 }; 66 66 67 67 /* Value structure for tag EXT4_FC_TAG_TAIL. */
+1 -1
fs/ksmbd/ksmbd_netlink.h
··· 241 241 struct ksmbd_spnego_authen_request { 242 242 __u32 handle; 243 243 __u16 spnego_blob_len; /* the length of spnego_blob */ 244 - __u8 spnego_blob[0]; /* 244 + __u8 spnego_blob[]; /* 245 245 * the GSS token from SecurityBuffer of 246 246 * SMB2 SESSION SETUP request 247 247 */
+3 -3
fs/ksmbd/ntlmssp.h
··· 95 95 struct target_info { 96 96 __le16 Type; 97 97 __le16 Length; 98 - __u8 Content[0]; 98 + __u8 Content[]; 99 99 } __packed; 100 100 101 101 struct negotiate_message { ··· 108 108 * struct security_buffer for version info not present since we 109 109 * do not set the version is present flag 110 110 */ 111 - char DomainString[0]; 111 + char DomainString[]; 112 112 /* followed by WorkstationString */ 113 113 } __packed; 114 114 ··· 140 140 * struct security_buffer for version info not present since we 141 141 * do not set the version is present flag 142 142 */ 143 - char UserString[0]; 143 + char UserString[]; 144 144 } __packed; 145 145 146 146 struct ntlmv2_resp {
+4 -4
fs/ksmbd/smb2pdu.h
··· 759 759 __u8 Reserved[7]; 760 760 __u64 RootDirectory; /* MBZ for network operations (why says spec?) */ 761 761 __le32 FileNameLength; 762 - char FileName[0]; /* New name to be assigned */ 762 + char FileName[]; /* New name to be assigned */ 763 763 } __packed; /* level 10 Set */ 764 764 765 765 struct smb2_file_link_info { /* encoding of request for level 11 */ ··· 768 768 __u8 Reserved[7]; 769 769 __u64 RootDirectory; /* MBZ for network operations (why says spec?) */ 770 770 __le32 FileNameLength; 771 - char FileName[0]; /* Name to be assigned to new link */ 771 + char FileName[]; /* Name to be assigned to new link */ 772 772 } __packed; /* level 11 Set */ 773 773 774 774 /* ··· 810 810 811 811 struct smb2_file_alt_name_info { 812 812 __le32 FileNameLength; 813 - char FileName[0]; 813 + char FileName[]; 814 814 } __packed; 815 815 816 816 struct smb2_file_stream_info { ··· 818 818 __le32 StreamNameLength; 819 819 __le64 StreamSize; 820 820 __le64 StreamAllocationSize; 821 - char StreamName[0]; 821 + char StreamName[]; 822 822 } __packed; 823 823 824 824 struct smb2_file_eof_info { /* encoding of request for level 10 */
+1 -1
fs/ksmbd/transport_rdma.c
··· 211 211 struct completion *completion; 212 212 struct rdma_rw_ctx rw_ctx; 213 213 struct sg_table sgt; 214 - struct scatterlist sg_list[0]; 214 + struct scatterlist sg_list[]; 215 215 }; 216 216 217 217 static inline int get_buf_page_count(void *buf, int size)
+1 -1
fs/ksmbd/xattr.h
··· 76 76 struct xattr_smb_acl { 77 77 int count; 78 78 int next; 79 - struct xattr_acl_entry entries[0]; 79 + struct xattr_acl_entry entries[]; 80 80 }; 81 81 82 82 /* 64bytes hash in xattr_ntacl is computed with sha256 */
+1 -1
fs/xfs/scrub/attr.h
··· 24 24 * space bitmap follows immediately after; and we have a third buffer 25 25 * for storing intermediate bitmap results. 26 26 */ 27 - uint8_t buf[0]; 27 + uint8_t buf[]; 28 28 }; 29 29 30 30 /* A place to store attribute values. */
+2 -2
include/asm-generic/tlb.h
··· 180 180 struct rcu_head rcu; 181 181 #endif 182 182 unsigned int nr; 183 - void *tables[0]; 183 + void *tables[]; 184 184 }; 185 185 186 186 #define MAX_TABLE_BATCH \ ··· 227 227 struct mmu_gather_batch *next; 228 228 unsigned int nr; 229 229 unsigned int max; 230 - struct page *pages[0]; 230 + struct page *pages[]; 231 231 }; 232 232 233 233 #define MAX_GATHER_BATCH \
+2 -2
include/linux/greybus/greybus_manifest.h
··· 100 100 struct greybus_descriptor_string { 101 101 __u8 length; 102 102 __u8 id; 103 - __u8 string[0]; 103 + __u8 string[]; 104 104 } __packed; 105 105 106 106 /* ··· 175 175 176 176 struct greybus_manifest { 177 177 struct greybus_manifest_header header; 178 - struct greybus_descriptor descriptors[0]; 178 + struct greybus_descriptor descriptors[]; 179 179 } __packed; 180 180 181 181 #endif /* __GREYBUS_MANIFEST_H */
+1 -1
include/linux/greybus/hd.h
··· 58 58 59 59 struct gb_svc *svc; 60 60 /* Private data for the host driver */ 61 - unsigned long hd_priv[0] __aligned(sizeof(s64)); 61 + unsigned long hd_priv[] __aligned(sizeof(s64)); 62 62 }; 63 63 #define to_gb_host_device(d) container_of(d, struct gb_host_device, dev) 64 64
+1 -1
include/linux/greybus/module.h
··· 23 23 24 24 bool disconnected; 25 25 26 - struct gb_interface *interfaces[0]; 26 + struct gb_interface *interfaces[]; 27 27 }; 28 28 #define to_gb_module(d) container_of(d, struct gb_module, dev) 29 29
+3 -3
include/linux/i3c/ccc.h
··· 132 132 struct i3c_ccc_defslvs { 133 133 u8 count; 134 134 struct i3c_ccc_dev_desc master; 135 - struct i3c_ccc_dev_desc slaves[0]; 135 + struct i3c_ccc_dev_desc slaves[]; 136 136 } __packed; 137 137 138 138 /** ··· 240 240 */ 241 241 struct i3c_ccc_setbrgtgt { 242 242 u8 count; 243 - struct i3c_ccc_bridged_slave_desc bslaves[0]; 243 + struct i3c_ccc_bridged_slave_desc bslaves[]; 244 244 } __packed; 245 245 246 246 /** ··· 318 318 */ 319 319 struct i3c_ccc_setxtime { 320 320 u8 subcmd; 321 - u8 data[0]; 321 + u8 data[]; 322 322 } __packed; 323 323 324 324 #define I3C_CCC_GETXTIME_SYNC_MODE BIT(0)
+1 -1
include/linux/platform_data/brcmfmac.h
··· 178 178 void (*power_off)(void); 179 179 char *fw_alternative_path; 180 180 int device_count; 181 - struct brcmfmac_pd_device devices[0]; 181 + struct brcmfmac_pd_device devices[]; 182 182 }; 183 183 184 184
+1 -1
include/linux/platform_data/cros_ec_commands.h
··· 5644 5644 uint8_t svid_count; /* Number of SVIDs partner sent */ 5645 5645 uint16_t reserved; 5646 5646 uint32_t discovery_vdo[6]; /* Max VDOs allowed after VDM header is 6 */ 5647 - struct svid_mode_info svids[0]; 5647 + struct svid_mode_info svids[]; 5648 5648 } __ec_align1; 5649 5649 5650 5650 /* USB Type-C commands for AP-controlled device policy. */
+1 -1
include/net/bluetooth/mgmt.h
··· 696 696 #define MGMT_READ_CONTROLLER_CAP_SIZE 0 697 697 struct mgmt_rp_read_controller_cap { 698 698 __le16 cap_len; 699 - __u8 cap[0]; 699 + __u8 cap[]; 700 700 } __packed; 701 701 702 702 #define MGMT_OP_READ_EXP_FEATURES_INFO 0x0049
+1 -1
include/net/ioam6.h
··· 35 35 int len; 36 36 __be32 hdr; 37 37 38 - u8 data[0]; 38 + u8 data[]; 39 39 }; 40 40 41 41 struct ioam6_pernet_data {
+2 -2
include/sound/sof/channel_map.h
··· 39 39 uint32_t ext_id; 40 40 uint32_t ch_mask; 41 41 uint32_t reserved; 42 - int32_t ch_coeffs[0]; 42 + int32_t ch_coeffs[]; 43 43 } __packed; 44 44 45 45 /** ··· 55 55 struct sof_ipc_cmd_hdr hdr; 56 56 uint32_t num_ch_map; 57 57 uint32_t reserved[3]; 58 - struct sof_ipc_channel_map ch_map[0]; 58 + struct sof_ipc_channel_map ch_map[]; 59 59 } __packed; 60 60 61 61 #endif /* __IPC_CHANNEL_MAP_H__ */
+2 -2
scripts/dtc/libfdt/fdt.h
··· 35 35 36 36 struct fdt_node_header { 37 37 fdt32_t tag; 38 - char name[0]; 38 + char name[]; 39 39 }; 40 40 41 41 struct fdt_property { 42 42 fdt32_t tag; 43 43 fdt32_t len; 44 44 fdt32_t nameoff; 45 - char data[0]; 45 + char data[]; 46 46 }; 47 47 48 48 #endif /* !__ASSEMBLY */
+2 -2
sound/soc/intel/atom/sst-mfld-dsp.h
··· 427 427 428 428 struct snd_sst_async_msg { 429 429 u32 msg_id; /* Async msg id */ 430 - u32 payload[0]; 430 + u32 payload[]; 431 431 }; 432 432 433 433 struct snd_sst_async_err_msg { ··· 514 514 u8 pipe_id; 515 515 u8 rsvd; 516 516 u16 len; 517 - char bytes[0]; 517 + char bytes[]; 518 518 }; 519 519 520 520 #define MAX_VTSV_FILES 2
+1 -1
sound/soc/intel/skylake/skl-topology.h
··· 164 164 u8 reserved[8]; 165 165 u32 priv_param_length; 166 166 /* Input pin formats followed by output ones. */ 167 - struct skl_pin_format pins_fmt[0]; 167 + struct skl_pin_format pins_fmt[]; 168 168 } __packed; 169 169 170 170 struct skl_algo_cfg {
+1 -1
tools/lib/perf/include/perf/event.h
··· 240 240 struct perf_record_id_index { 241 241 struct perf_event_header header; 242 242 __u64 nr; 243 - struct id_index_entry entries[0]; 243 + struct id_index_entry entries[]; 244 244 }; 245 245 246 246 struct perf_record_auxtrace_info {