Re: [PATCH] staging: rtl8188eu: convert DBG_88E calls in core/rtw_sta_mgt.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jun 13, 2021 at 12:28:31AM +0100, Phillip Potter wrote:
> Convert both calls to the DBG_88E macro in core/rtw_sta_mgt.c into
> netdev_dbg calls. The DBG_88E macro is unnecessary, as visibility of
> debug messages can be controlled more precisely by just using debugfs.
> It is important to keep these messages still, as they are displayable
> via a kernel module parameter when using DBG_88E.
> 
> Signed-off-by: Phillip Potter <phil@xxxxxxxxxxxxxxxx>
> ---
>  drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
> index 5af7af5f5a5a..ad1d851a2f69 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
> @@ -113,17 +113,20 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv)
>  inline int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta)
>  {
>  	int offset = (((u8 *)sta) - stapriv->pstainfo_buf) / sizeof(struct sta_info);
> +	struct net_device *pnetdev = stapriv->padapter->pnetdev;
>  
>  	if (!stainfo_offset_valid(offset))
> -		DBG_88E("%s invalid offset(%d), out of range!!!", __func__, offset);
> +		netdev_dbg(pnetdev, "invalid offset(%d), out of range!!!", offset);
>  
>  	return offset;
>  }
>  
>  inline struct sta_info *rtw_get_stainfo_by_offset(struct sta_priv *stapriv, int offset)
>  {
> +	struct net_device *pnetdev = stapriv->padapter->pnetdev;
> +
>  	if (!stainfo_offset_valid(offset))
> -		DBG_88E("%s invalid offset(%d), out of range!!!", __func__, offset);
> +		netdev_dbg(pnetdev, "invalid offset(%d), out of range!!!", offset);

This should be an error and the code should handle it correctly instead
of reading beyond the end of the struct.

regards,
dan carpenter





[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux