Skip to content

Commit 1e6e9d0

Browse files
uapi: revert flexible-array conversions
These structures can get embedded in other structures in user-space and cause all sorts of warnings and problems. So, we better don't take any chances and keep the zero-length arrays in place for now. Signed-off-by: Gustavo A. R. Silva <[email protected]>
1 parent 0e698df commit 1e6e9d0

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

include/uapi/linux/bpf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ struct bpf_insn {
7373
/* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */
7474
struct bpf_lpm_trie_key {
7575
__u32 prefixlen; /* up to 32 for AF_INET, 128 for AF_INET6 */
76-
__u8 data[]; /* Arbitrary size */
76+
__u8 data[0]; /* Arbitrary size */
7777
};
7878

7979
struct bpf_cgroup_storage_key {

include/uapi/linux/dlm_device.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ struct dlm_lock_params {
4545
void __user *bastaddr;
4646
struct dlm_lksb __user *lksb;
4747
char lvb[DLM_USER_LVB_LEN];
48-
char name[];
48+
char name[0];
4949
};
5050

5151
struct dlm_lspace_params {
5252
__u32 flags;
5353
__u32 minor;
54-
char name[];
54+
char name[0];
5555
};
5656

5757
struct dlm_purge_params {

include/uapi/linux/fiemap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct fiemap {
3434
__u32 fm_mapped_extents;/* number of extents that were mapped (out) */
3535
__u32 fm_extent_count; /* size of fm_extents array (in) */
3636
__u32 fm_reserved;
37-
struct fiemap_extent fm_extents[]; /* array of mapped extents (out) */
37+
struct fiemap_extent fm_extents[0]; /* array of mapped extents (out) */
3838
};
3939

4040
#define FIEMAP_MAX_OFFSET (~0ULL)

include/uapi/linux/if_arcnet.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ struct arc_rfc1201 {
6060
__u8 proto; /* protocol ID field - varies */
6161
__u8 split_flag; /* for use with split packets */
6262
__be16 sequence; /* sequence number */
63-
__u8 payload[]; /* space remaining in packet (504 bytes)*/
63+
__u8 payload[0]; /* space remaining in packet (504 bytes)*/
6464
};
6565
#define RFC1201_HDR_SIZE 4
6666

@@ -69,7 +69,7 @@ struct arc_rfc1201 {
6969
*/
7070
struct arc_rfc1051 {
7171
__u8 proto; /* ARC_P_RFC1051_ARP/RFC1051_IP */
72-
__u8 payload[]; /* 507 bytes */
72+
__u8 payload[0]; /* 507 bytes */
7373
};
7474
#define RFC1051_HDR_SIZE 1
7575

@@ -80,7 +80,7 @@ struct arc_rfc1051 {
8080
struct arc_eth_encap {
8181
__u8 proto; /* Always ARC_P_ETHER */
8282
struct ethhdr eth; /* standard ethernet header (yuck!) */
83-
__u8 payload[]; /* 493 bytes */
83+
__u8 payload[0]; /* 493 bytes */
8484
};
8585
#define ETH_ENCAP_HDR_SIZE 14
8686

include/uapi/linux/mmc/ioctl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ struct mmc_ioc_cmd {
5757
*/
5858
struct mmc_ioc_multi_cmd {
5959
__u64 num_of_cmds;
60-
struct mmc_ioc_cmd cmds[];
60+
struct mmc_ioc_cmd cmds[0];
6161
};
6262

6363
#define MMC_IOC_CMD _IOWR(MMC_BLOCK_MAJOR, 0, struct mmc_ioc_cmd)

include/uapi/linux/net_dropmon.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ struct net_dm_config_entry {
2929

3030
struct net_dm_config_msg {
3131
__u32 entries;
32-
struct net_dm_config_entry options[];
32+
struct net_dm_config_entry options[0];
3333
};
3434

3535
struct net_dm_alert_msg {
3636
__u32 entries;
37-
struct net_dm_drop_point points[];
37+
struct net_dm_drop_point points[0];
3838
};
3939

4040
struct net_dm_user_msg {

include/uapi/linux/netfilter_bridge/ebt_among.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ struct ebt_mac_wormhash_tuple {
4040
struct ebt_mac_wormhash {
4141
int table[257];
4242
int poolsize;
43-
struct ebt_mac_wormhash_tuple pool[];
43+
struct ebt_mac_wormhash_tuple pool[0];
4444
};
4545

4646
#define ebt_mac_wormhash_size(x) ((x) ? sizeof(struct ebt_mac_wormhash) \

include/uapi/scsi/scsi_bsg_fc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ struct fc_bsg_host_vendor {
209209
__u64 vendor_id;
210210

211211
/* start of vendor command area */
212-
__u32 vendor_cmd[];
212+
__u32 vendor_cmd[0];
213213
};
214214

215215
/* Response:

0 commit comments

Comments
 (0)