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

b43: use temporary rate_index for error checking

The mac80211 rate_index changed to be a u8, so
can't hold the negative error value properly.
Use a temporary variable for error checking.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Johannes Berg and committed by
John W. Linville
1924b4e2 00267d59

+5 -4
+5 -4
drivers/net/wireless/b43/xmit.c
··· 663 663 u32 uninitialized_var(macstat); 664 664 u16 chanid; 665 665 u16 phytype; 666 - int padding; 666 + int padding, rate_idx; 667 667 668 668 memset(&status, 0, sizeof(status)); 669 669 ··· 766 766 } 767 767 768 768 if (phystat0 & B43_RX_PHYST0_OFDM) 769 - status.rate_idx = b43_plcp_get_bitrate_idx_ofdm(plcp, 769 + rate_idx = b43_plcp_get_bitrate_idx_ofdm(plcp, 770 770 phytype == B43_PHYTYPE_A); 771 771 else 772 - status.rate_idx = b43_plcp_get_bitrate_idx_cck(plcp); 773 - if (unlikely(status.rate_idx == -1)) { 772 + rate_idx = b43_plcp_get_bitrate_idx_cck(plcp); 773 + if (unlikely(rate_idx == -1)) { 774 774 /* PLCP seems to be corrupted. 775 775 * Drop the frame, if we are not interested in corrupted frames. */ 776 776 if (!(dev->wl->filter_flags & FIF_PLCPFAIL)) 777 777 goto drop; 778 778 } 779 + status.rate_idx = rate_idx; 779 780 status.antenna = !!(phystat0 & B43_RX_PHYST0_ANT); 780 781 781 782 /*