mirror of https://gitee.com/openkylin/linux.git
mwifiex: use 'total_ie_len' in mwifiex_update_bss_desc_with_ie()
This is clearer than copy/pasting the magic number '+ 2' around, and it even saves the need for one existing comment. Cc: Takashi Iwai <tiwai@suse.de> Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
parent
7da413a185
commit
0a3ce16947
|
@ -1270,7 +1270,7 @@ int mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WLAN_EID_FH_PARAMS:
|
case WLAN_EID_FH_PARAMS:
|
||||||
if (element_len + 2 < sizeof(*fh_param_set))
|
if (total_ie_len < sizeof(*fh_param_set))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
fh_param_set =
|
fh_param_set =
|
||||||
(struct ieee_types_fh_param_set *) current_ptr;
|
(struct ieee_types_fh_param_set *) current_ptr;
|
||||||
|
@ -1280,7 +1280,7 @@ int mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WLAN_EID_DS_PARAMS:
|
case WLAN_EID_DS_PARAMS:
|
||||||
if (element_len + 2 < sizeof(*ds_param_set))
|
if (total_ie_len < sizeof(*ds_param_set))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
ds_param_set =
|
ds_param_set =
|
||||||
(struct ieee_types_ds_param_set *) current_ptr;
|
(struct ieee_types_ds_param_set *) current_ptr;
|
||||||
|
@ -1293,7 +1293,7 @@ int mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WLAN_EID_CF_PARAMS:
|
case WLAN_EID_CF_PARAMS:
|
||||||
if (element_len + 2 < sizeof(*cf_param_set))
|
if (total_ie_len < sizeof(*cf_param_set))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
cf_param_set =
|
cf_param_set =
|
||||||
(struct ieee_types_cf_param_set *) current_ptr;
|
(struct ieee_types_cf_param_set *) current_ptr;
|
||||||
|
@ -1303,7 +1303,7 @@ int mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WLAN_EID_IBSS_PARAMS:
|
case WLAN_EID_IBSS_PARAMS:
|
||||||
if (element_len + 2 < sizeof(*ibss_param_set))
|
if (total_ie_len < sizeof(*ibss_param_set))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
ibss_param_set =
|
ibss_param_set =
|
||||||
(struct ieee_types_ibss_param_set *)
|
(struct ieee_types_ibss_param_set *)
|
||||||
|
@ -1460,10 +1460,8 @@ int mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
current_ptr += element_len + 2;
|
current_ptr += total_ie_len;
|
||||||
|
bytes_left -= total_ie_len;
|
||||||
/* Need to account for IE ID and IE Len */
|
|
||||||
bytes_left -= (element_len + 2);
|
|
||||||
|
|
||||||
} /* while (bytes_left > 2) */
|
} /* while (bytes_left > 2) */
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue