Skip to content

Commit e2b5421

Browse files
committed
Merge tag 'flexible-array-transformations-UAPI-6.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux
Pull uapi flexible array update from Gustavo Silva: "A treewide patch that replaces zero-length arrays with flexible-array members in UAPI. This has been baking in linux-next for 5 weeks now. '-fstrict-flex-arrays=3' is coming and we need to land these changes to prevent issues like these in the short future: fs/minix/dir.c:337:3: warning: 'strcpy' will always overflow; destination buffer has size 0, but the source string has length 2 (including NUL byte) [-Wfortify-source] strcpy(de3->name, "."); ^ Since these are all [0] to [] changes, the risk to UAPI is nearly zero. If this breaks anything, we can use a union with a new member name" Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 * tag 'flexible-array-transformations-UAPI-6.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux: treewide: uapi: Replace zero-length arrays with flexible-array members
2 parents e05d5b9 + 94dfc73 commit e2b5421

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+216
-216
lines changed

arch/m68k/include/uapi/asm/bootinfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
struct bi_record {
3535
__be16 tag; /* tag ID */
3636
__be16 size; /* size of record (in bytes) */
37-
__be32 data[0]; /* data */
37+
__be32 data[]; /* data */
3838
};
3939

4040

@@ -168,7 +168,7 @@ struct bootversion {
168168
struct {
169169
__be32 machtype;
170170
__be32 version;
171-
} machversions[0];
171+
} machversions[];
172172
} __packed;
173173

174174
#endif /* __ASSEMBLY__ */

arch/mips/include/uapi/asm/ucontext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ struct ucontext {
6060
sigset_t uc_sigmask;
6161

6262
/* Extended context structures may follow ucontext */
63-
unsigned long long uc_extcontext[0];
63+
unsigned long long uc_extcontext[];
6464
};
6565

6666
#endif /* __MIPS_UAPI_ASM_UCONTEXT_H */

arch/s390/include/uapi/asm/hwctrset.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@ struct s390_ctrset_start { /* Set CPUs to operate on */
3030
struct s390_ctrset_setdata { /* Counter set data */
3131
__u32 set; /* Counter set number */
3232
__u32 no_cnts; /* # of counters stored in cv[] */
33-
__u64 cv[0]; /* Counter values (variable length) */
33+
__u64 cv[]; /* Counter values (variable length) */
3434
};
3535

3636
struct s390_ctrset_cpudata { /* Counter set data per CPU */
3737
__u32 cpu_nr; /* CPU number */
3838
__u32 no_sets; /* # of counters sets in data[] */
39-
struct s390_ctrset_setdata data[0];
39+
struct s390_ctrset_setdata data[];
4040
};
4141

4242
struct s390_ctrset_read { /* Structure to get all ctr sets */
4343
__u64 no_cpus; /* Total # of CPUs data taken from */
44-
struct s390_ctrset_cpudata data[0];
44+
struct s390_ctrset_cpudata data[];
4545
};
4646

4747
#define S390_HWCTR_MAGIC 'C' /* Random magic # for ioctls */

arch/x86/include/uapi/asm/bootparam.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct setup_data {
5353
__u64 next;
5454
__u32 type;
5555
__u32 len;
56-
__u8 data[0];
56+
__u8 data[];
5757
};
5858

5959
/* extensible setup indirect data node */

arch/x86/include/uapi/asm/kvm.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,13 @@ struct kvm_msrs {
198198
__u32 nmsrs; /* number of msrs in entries */
199199
__u32 pad;
200200

201-
struct kvm_msr_entry entries[0];
201+
struct kvm_msr_entry entries[];
202202
};
203203

204204
/* for KVM_GET_MSR_INDEX_LIST */
205205
struct kvm_msr_list {
206206
__u32 nmsrs; /* number of msrs in entries */
207-
__u32 indices[0];
207+
__u32 indices[];
208208
};
209209

210210
/* Maximum size of any access bitmap in bytes */
@@ -241,7 +241,7 @@ struct kvm_cpuid_entry {
241241
struct kvm_cpuid {
242242
__u32 nent;
243243
__u32 padding;
244-
struct kvm_cpuid_entry entries[0];
244+
struct kvm_cpuid_entry entries[];
245245
};
246246

247247
struct kvm_cpuid_entry2 {
@@ -263,7 +263,7 @@ struct kvm_cpuid_entry2 {
263263
struct kvm_cpuid2 {
264264
__u32 nent;
265265
__u32 padding;
266-
struct kvm_cpuid_entry2 entries[0];
266+
struct kvm_cpuid_entry2 entries[];
267267
};
268268

269269
/* for KVM_GET_PIT and KVM_SET_PIT */
@@ -389,7 +389,7 @@ struct kvm_xsave {
389389
* the contents of CPUID leaf 0xD on the host.
390390
*/
391391
__u32 region[1024];
392-
__u32 extra[0];
392+
__u32 extra[];
393393
};
394394

395395
#define KVM_MAX_XCRS 16
@@ -516,7 +516,7 @@ struct kvm_pmu_event_filter {
516516
__u32 fixed_counter_bitmap;
517517
__u32 flags;
518518
__u32 pad[4];
519-
__u64 events[0];
519+
__u64 events[];
520520
};
521521

522522
#define KVM_PMU_EVENT_ALLOW 0

include/uapi/drm/i915_drm.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2123,7 +2123,7 @@ struct i915_context_engines_load_balance {
21232123

21242124
__u64 mbz64; /* reserved for future use; must be zero */
21252125

2126-
struct i915_engine_class_instance engines[0];
2126+
struct i915_engine_class_instance engines[];
21272127
} __attribute__((packed));
21282128

21292129
#define I915_DEFINE_CONTEXT_ENGINES_LOAD_BALANCE(name__, N__) struct { \
@@ -2161,7 +2161,7 @@ struct i915_context_engines_bond {
21612161
__u64 flags; /* all undefined flags must be zero */
21622162
__u64 mbz64[4]; /* reserved for future use; must be zero */
21632163

2164-
struct i915_engine_class_instance engines[0];
2164+
struct i915_engine_class_instance engines[];
21652165
} __attribute__((packed));
21662166

21672167
#define I915_DEFINE_CONTEXT_ENGINES_BOND(name__, N__) struct { \
@@ -2288,7 +2288,7 @@ struct i915_context_engines_parallel_submit {
22882288
* length = width (i) * num_siblings (j)
22892289
* index = j + i * num_siblings
22902290
*/
2291-
struct i915_engine_class_instance engines[0];
2291+
struct i915_engine_class_instance engines[];
22922292

22932293
} __packed;
22942294

include/uapi/linux/blkzoned.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ struct blk_zone_report {
130130
__u64 sector;
131131
__u32 nr_zones;
132132
__u32 flags;
133-
struct blk_zone zones[0];
133+
struct blk_zone zones[];
134134
};
135135

136136
/**

include/uapi/linux/bpf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ struct bpf_insn {
7979
/* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */
8080
struct bpf_lpm_trie_key {
8181
__u32 prefixlen; /* up to 32 for AF_INET, 128 for AF_INET6 */
82-
__u8 data[0]; /* Arbitrary size */
82+
__u8 data[]; /* Arbitrary size */
8383
};
8484

8585
struct bpf_cgroup_storage_key {

include/uapi/linux/btrfs.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ struct btrfs_qgroup_inherit {
9393
__u64 num_ref_copies;
9494
__u64 num_excl_copies;
9595
struct btrfs_qgroup_limit lim;
96-
__u64 qgroups[0];
96+
__u64 qgroups[];
9797
};
9898

9999
struct btrfs_ioctl_qgroup_limit_args {
@@ -561,7 +561,7 @@ struct btrfs_ioctl_search_args_v2 {
561561
__u64 buf_size; /* in - size of buffer
562562
* out - on EOVERFLOW: needed size
563563
* to store item */
564-
__u64 buf[0]; /* out - found items */
564+
__u64 buf[]; /* out - found items */
565565
};
566566

567567
struct btrfs_ioctl_clone_range_args {
@@ -632,7 +632,7 @@ struct btrfs_ioctl_same_args {
632632
__u16 dest_count; /* in - total elements in info array */
633633
__u16 reserved1;
634634
__u32 reserved2;
635-
struct btrfs_ioctl_same_extent_info info[0];
635+
struct btrfs_ioctl_same_extent_info info[];
636636
};
637637

638638
struct btrfs_ioctl_space_info {
@@ -644,15 +644,15 @@ struct btrfs_ioctl_space_info {
644644
struct btrfs_ioctl_space_args {
645645
__u64 space_slots;
646646
__u64 total_spaces;
647-
struct btrfs_ioctl_space_info spaces[0];
647+
struct btrfs_ioctl_space_info spaces[];
648648
};
649649

650650
struct btrfs_data_container {
651651
__u32 bytes_left; /* out -- bytes not needed to deliver output */
652652
__u32 bytes_missing; /* out -- additional bytes needed for result */
653653
__u32 elem_cnt; /* out */
654654
__u32 elem_missed; /* out */
655-
__u64 val[0]; /* out */
655+
__u64 val[]; /* out */
656656
};
657657

658658
struct btrfs_ioctl_ino_path_args {

include/uapi/linux/btrfs_tree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ struct btrfs_inode_extref {
575575
__le64 parent_objectid;
576576
__le64 index;
577577
__le16 name_len;
578-
__u8 name[0];
578+
__u8 name[];
579579
/* name goes here */
580580
} __attribute__ ((__packed__));
581581

0 commit comments

Comments
 (0)