Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rtlwifi: rtl8192cu: Fix more pointer arithmetic errors

This driver uses a number of macros to get and set various fields in the
RX and TX descriptors. To work correctly, a u8 pointer to the descriptor
must be used; however, in some cases a descriptor structure pointer is used
instead. In addition, a duplicated statement is removed.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Reported-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: Stable <stable@vger.kernel.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Larry Finger and committed by
John W. Linville
eafbdde9 353d2a69

+6 -6
+3 -3
drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
··· 769 769 770 770 static void _rtl92c_query_rxphystatus(struct ieee80211_hw *hw, 771 771 struct rtl_stats *pstats, 772 - struct rx_desc_92c *pdesc, 772 + struct rx_desc_92c *p_desc, 773 773 struct rx_fwinfo_92c *p_drvinfo, 774 774 bool packet_match_bssid, 775 775 bool packet_toself, ··· 784 784 u32 rssi, total_rssi = 0; 785 785 bool in_powersavemode = false; 786 786 bool is_cck_rate; 787 + u8 *pdesc = (u8 *)p_desc; 787 788 788 - is_cck_rate = RX_HAL_IS_CCK_RATE(pdesc); 789 + is_cck_rate = RX_HAL_IS_CCK_RATE(p_desc); 789 790 pstats->packet_matchbssid = packet_match_bssid; 790 791 pstats->packet_toself = packet_toself; 791 - pstats->is_cck = is_cck_rate; 792 792 pstats->packet_beacon = packet_beacon; 793 793 pstats->is_cck = is_cck_rate; 794 794 pstats->RX_SIGQ[0] = -1;
+3 -3
drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
··· 303 303 bool rtl92cu_rx_query_desc(struct ieee80211_hw *hw, 304 304 struct rtl_stats *stats, 305 305 struct ieee80211_rx_status *rx_status, 306 - u8 *p_desc, struct sk_buff *skb) 306 + u8 *pdesc, struct sk_buff *skb) 307 307 { 308 308 struct rx_fwinfo_92c *p_drvinfo; 309 - struct rx_desc_92c *pdesc = (struct rx_desc_92c *)p_desc; 309 + struct rx_desc_92c *p_desc = (struct rx_desc_92c *)pdesc; 310 310 u32 phystatus = GET_RX_DESC_PHY_STATUS(pdesc); 311 311 312 312 stats->length = (u16) GET_RX_DESC_PKT_LEN(pdesc); ··· 345 345 if (phystatus) { 346 346 p_drvinfo = (struct rx_fwinfo_92c *)(skb->data + 347 347 stats->rx_bufshift); 348 - rtl92c_translate_rx_signal_stuff(hw, skb, stats, pdesc, 348 + rtl92c_translate_rx_signal_stuff(hw, skb, stats, p_desc, 349 349 p_drvinfo); 350 350 } 351 351 /*rx_status->qual = stats->signal; */