From a2482566203d5ea56cc32c4efe3abdec5388a187 Mon Sep 17 00:00:00 2001 From: Fugang Duan Date: Mon, 13 Jan 2020 11:18:18 +0800 Subject: [PATCH] mwifiex: 8997: fix the build warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- mwifiex_8997/mlan/mlan_ioctl.h | 2 +- mwifiex_8997/mlinux/mlan_ioctl.h | 2 +- mwifiex_8997/mlinux/moal_eth_ioctl.c | 6 ++++-- mwifiex_8997/mlinux/moal_priv.c | 6 +++--- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/mwifiex_8997/mlan/mlan_ioctl.h b/mwifiex_8997/mlan/mlan_ioctl.h index 7967f45..a0ea0b0 100755 --- a/mwifiex_8997/mlan/mlan_ioctl.h +++ b/mwifiex_8997/mlan/mlan_ioctl.h @@ -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; /*-----------------------------------------------------------------*/ diff --git a/mwifiex_8997/mlinux/mlan_ioctl.h b/mwifiex_8997/mlinux/mlan_ioctl.h index 7967f45..a0ea0b0 100755 --- a/mwifiex_8997/mlinux/mlan_ioctl.h +++ b/mwifiex_8997/mlinux/mlan_ioctl.h @@ -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; /*-----------------------------------------------------------------*/ diff --git a/mwifiex_8997/mlinux/moal_eth_ioctl.c b/mwifiex_8997/mlinux/moal_eth_ioctl.c index a4e8a40..e0c6ea0 100755 --- a/mwifiex_8997/mlinux/moal_eth_ioctl.c +++ b/mwifiex_8997/mlinux/moal_eth_ioctl.c @@ -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; diff --git a/mwifiex_8997/mlinux/moal_priv.c b/mwifiex_8997/mlinux/moal_priv.c index 22d86ed..6f14ee9 100755 --- a/mwifiex_8997/mlinux/moal_priv.c +++ b/mwifiex_8997/mlinux/moal_priv.c @@ -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; }