mwifiex: 8997: fix the build warning

Fix below build warning:
mlnux/moal_cfg80211.h:464:29: warning: large integer implicitly truncated to unsigned type [-Woverflow]
 #define REGULATORY_CFG_LEN  (NL80211_MAX_SUPP_REG_RULES << 1)
                             ^
mlinux/moal_sta_cfg80211.c:7711:42: note: in expansion of macro ‘REGULATORY_CFG_LEN’
  misc->param.custom_reg_domain.cfg_len = REGULATORY_CFG_LEN;

mlinux/moal_eth_ioctl.c: In function ‘woal_priv_set_get_scancfg’:
mlinux/moal_eth_ioctl.c:4144:2: warning: ISO C90 forbids variable length array ‘data’ [-Wvla]
  int data[arg_len];
  ^
  CC [M]  mlinux/moal_priv.o
mlinux/moal_priv.c: In function ‘woal_set_get_scan_cfg’:
mlinux/moal_priv.c:4818:2: warning: ISO C90 forbids variable length array ‘data’ [-Wvla]
  int data[arg_len], copy_len;
  ^

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
This commit is contained in:
Fugang Duan 2020-01-13 11:18:18 +08:00
parent 280b53192f
commit a248256620
4 changed files with 9 additions and 7 deletions

View File

@ -1214,7 +1214,7 @@ typedef struct _mlan_ds_bss {
/** Type definition of mlan_ds_custom_reg_domain */
typedef struct _mlan_ds_custom_reg_domain {
t_u8 cfg_len;
t_u16 cfg_len;
t_u8 cfg_buf[0];
} mlan_ds_custom_reg_domain;
/*-----------------------------------------------------------------*/

View File

@ -1214,7 +1214,7 @@ typedef struct _mlan_ds_bss {
/** Type definition of mlan_ds_custom_reg_domain */
typedef struct _mlan_ds_custom_reg_domain {
t_u8 cfg_len;
t_u16 cfg_len;
t_u8 cfg_buf[0];
} mlan_ds_custom_reg_domain;
/*-----------------------------------------------------------------*/

View File

@ -4135,13 +4135,15 @@ done:
*
* @return 0 --success, otherwise fail
*/
#define CMD_SCANCFG_DATA_LEN 8
int
woal_priv_set_get_scancfg(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen)
{
int ret = 0;
int user_data_len = 0;
int arg_len = 8;
int data[arg_len];
#define CMD_SCANCFG_DATA_LEN 8
int data[CMD_SCANCFG_DATA_LEN];
mlan_ds_scan *scan = NULL;
mlan_ioctl_req *req = NULL;
mlan_status status = MLAN_STATUS_SUCCESS;

View File

@ -4814,8 +4814,8 @@ static int
woal_set_get_scan_cfg(moal_private *priv, struct iwreq *wrq)
{
int ret = 0;
int arg_len = 7;
int data[arg_len], copy_len;
#define WOAL_SCAN_CFG_DATA_LEN 7
int data[WOAL_SCAN_CFG_DATA_LEN], copy_len;
mlan_ds_scan *scan = NULL;
mlan_ioctl_req *req = NULL;
int data_length = wrq->u.data.length;
@ -4828,7 +4828,7 @@ woal_set_get_scan_cfg(moal_private *priv, struct iwreq *wrq)
ret = -ENOMEM;
goto done;
}
if (data_length > arg_len) {
if (data_length > WOAL_SCAN_CFG_DATA_LEN) {
ret = -EINVAL;
goto done;
}