Re: [PATCH v2 5/7] staging: r8188eu: drop unnecessary wrapper _rtw_free_mlme_priv

From: Dan Carpenter
Date: Mon Apr 11 2022 - 06:33:54 EST


On Mon, Apr 11, 2022 at 03:51:34PM +0530, Vihas Makwana wrote:
> -void _rtw_free_mlme_priv(struct mlme_priv *pmlmepriv)
> -{
> -
> - rtw_free_mlme_priv_ie_data(pmlmepriv);
> -
> - if (pmlmepriv) {
> - vfree(pmlmepriv->free_bss_buf);
> - }
> -
> -}
> -
> struct wlan_network *_rtw_alloc_network(struct mlme_priv *pmlmepriv)/* _queue *free_queue) */
> {
> struct wlan_network *pnetwork;
> @@ -290,7 +279,11 @@ int rtw_init_mlme_priv(struct adapter *padapter)/* struct mlme_priv *pmlmepriv)
>
> void rtw_free_mlme_priv(struct mlme_priv *pmlmepriv)
> {
> - _rtw_free_mlme_priv(pmlmepriv);
> + rtw_free_mlme_priv_ie_data(pmlmepriv);
> +
> + if (pmlmepriv) {

Not related to your patch, but this check makes no sense. The
rtw_free_mlme_priv_ie_data() function dereference pmlmepriv
unconditionally so it would have already crashed.


> + vfree(pmlmepriv->free_bss_buf);
> + }
> }

regards,
dan carpenter