@@ -111,7 +111,7 @@ struct ndn_hpe1_smart {
__u32 status;
union {
__u8 buf[124];
- struct ndn_hpe1_smart_data data[0];
+ struct ndn_hpe1_smart_data data[1];
};
} __attribute__((packed));
@@ -136,7 +136,7 @@ struct ndn_hpe1_smart_threshold {
__u32 status;
union {
__u8 buf[32];
- struct ndn_hpe1_smart_threshold_data data[0];
+ struct ndn_hpe1_smart_threshold_data data[1];
};
} __attribute__((packed));
@@ -46,7 +46,7 @@ struct ndn_msft_smart {
__u32 status;
union {
__u8 buf[9];
- struct ndn_msft_smart_data data[0];
+ struct ndn_msft_smart_data data[1];
};
} __attribute__((packed));
@@ -91,7 +91,7 @@ struct nd_cmd_ars_status {
__u32 reserved;
__u64 err_address;
__u64 length;
- } __attribute__((packed)) records[0];
+ } __attribute__((packed)) records[];
} __attribute__((packed));
struct nd_cmd_clear_error {
GCC10 emits warnings like: msft.c: In function ‘msft_cmd_smart_get_media_temperature’: msft.c:146:28: warning: array subscript 0 is outside the bounds of an interior zero-length array ‘struct ndn_msft_smart_data[0]’ [-Wzero-length-bounds] hpe1.c: In function ‘hpe1_cmd_smart_get_flags’: hpe1.c:111:33: warning: array subscript 0 is outside the bounds of an interior zero-length array ‘struct ndn_hpe1_smart_data[0]’ [-Wzero-length-bounds] ars.c: In function ‘ndctl_cmd_ars_get_record_addr’: ars.c:274:38: warning: array subscript ‘(<unknown>) + 4294967295’ is outside the bounds of an interior zero-length array ‘struct nd_ars_record[0]’ [-Wzero-length-bounds] In the case of the 'msft' and 'hpe1' implementation the zero-length array is not needed because they are declared with a union of a buffer of the same size as a single element. Fix those cases by just declaring a single element array. The ARS case is different, it's complaining about an internal zero-length member. Switch to the recommended [1] flexible-array syntax for that case. [1]: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- ndctl/lib/hpe1.h | 4 ++-- ndctl/lib/msft.h | 2 +- ndctl/ndctl.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)