ieee80211: quash more ubsan warnings

Seems it doesn't like indexing into zero length arrays
either, it only allows C99 flexible array members.

Fixes warnings like:
UBSAN: array-index-out-of-bounds in /var/lib/dkms/rtl88x2bu/5.13.1/build/os_dep/linux/ioctl_cfg80211.c:1822:110
index 24 is out of range for type 'u8 [*]'
This commit is contained in:
Sultan Qasim Khan 2024-03-14 09:16:56 -04:00
parent 4e35c6b265
commit 116c6de724

View File

@ -335,7 +335,7 @@ typedef struct ieee_param {
struct { struct {
u32 len; u32 len;
u8 reserved[32]; u8 reserved[32];
u8 data[0]; u8 data[];
} wpa_ie; } wpa_ie;
struct { struct {
int command; int command;
@ -348,7 +348,7 @@ typedef struct ieee_param {
u8 idx; u8 idx;
u8 seq[8]; /* sequence counter (set: RX, get: TX) */ u8 seq[8]; /* sequence counter (set: RX, get: TX) */
u16 key_len; u16 key_len;
u8 key[0]; u8 key[];
} crypt; } crypt;
#ifdef CONFIG_AP_MODE #ifdef CONFIG_AP_MODE
struct { struct {
@ -360,7 +360,7 @@ typedef struct ieee_param {
} add_sta; } add_sta;
struct { struct {
u8 reserved[2];/* for set max_num_sta */ u8 reserved[2];/* for set max_num_sta */
u8 buf[0]; u8 buf[];
} bcn_ie; } bcn_ie;
#endif #endif
@ -371,7 +371,7 @@ typedef struct ieee_param {
typedef struct ieee_param_ex { typedef struct ieee_param_ex {
u32 cmd; u32 cmd;
u8 sta_addr[ETH_ALEN]; u8 sta_addr[ETH_ALEN];
u8 data[0]; u8 data[];
} ieee_param_ex; } ieee_param_ex;
struct sta_data { struct sta_data {
@ -1177,7 +1177,7 @@ struct ieee80211_info_element_hdr {
struct ieee80211_info_element { struct ieee80211_info_element {
u8 id; u8 id;
u8 len; u8 len;
u8 data[0]; u8 data[];
} __attribute__((packed)); } __attribute__((packed));
#endif #endif
@ -1249,7 +1249,7 @@ struct ieee80211_txb {
u16 reserved; u16 reserved;
u16 frag_size; u16 frag_size;
u16 payload_size; u16 payload_size;
struct sk_buff *fragments[0]; struct sk_buff *fragments[];
}; };