drivers/net/wireless/ath/ath9k/htc_drv_txrx.c:987:20: sparse: sparse: incorrect type in assignment (different base types)

From: kernel test robot
Date: Sat Aug 08 2020 - 15:23:09 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 11030fe96b57ad843518b0e9430f3cd4b3610ce2
commit: cd486e627e67ee9ab66914d36d3127ef057cc010 ath9k_htc: Discard undersized packets
date: 10 months ago
config: sparc64-randconfig-s032-20200809 (attached as .config)
compiler: sparc64-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-118-ge1578773-dirty
git checkout cd486e627e67ee9ab66914d36d3127ef057cc010
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=sparc64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)

>> drivers/net/wireless/ath/ath9k/htc_drv_txrx.c:987:20: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] rs_datalen @@ got unsigned short [usertype] @@
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c:987:20: sparse: expected restricted __be16 [usertype] rs_datalen
>> drivers/net/wireless/ath/ath9k/htc_drv_txrx.c:987:20: sparse: got unsigned short [usertype]
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c:988:13: sparse: sparse: restricted __be16 degrades to integer
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c:1001:13: sparse: sparse: restricted __be16 degrades to integer

vim +987 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c

962
963 static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv,
964 struct ath9k_htc_rxbuf *rxbuf,
965 struct ieee80211_rx_status *rx_status)
966
967 {
968 struct ieee80211_hdr *hdr;
969 struct ieee80211_hw *hw = priv->hw;
970 struct sk_buff *skb = rxbuf->skb;
971 struct ath_common *common = ath9k_hw_common(priv->ah);
972 struct ath_hw *ah = common->ah;
973 struct ath_htc_rx_status *rxstatus;
974 struct ath_rx_status rx_stats;
975 bool decrypt_error = false;
976 __be16 rs_datalen;
977 bool is_phyerr;
978
979 if (skb->len < HTC_RX_FRAME_HEADER_SIZE) {
980 ath_err(common, "Corrupted RX frame, dropping (len: %d)\n",
981 skb->len);
982 goto rx_next;
983 }
984
985 rxstatus = (struct ath_htc_rx_status *)skb->data;
986
> 987 rs_datalen = be16_to_cpu(rxstatus->rs_datalen);
988 if (unlikely(rs_datalen -
989 (skb->len - HTC_RX_FRAME_HEADER_SIZE) != 0)) {
990 ath_err(common,
991 "Corrupted RX data len, dropping (dlen: %d, skblen: %d)\n",
992 rs_datalen, skb->len);
993 goto rx_next;
994 }
995
996 is_phyerr = rxstatus->rs_status & ATH9K_RXERR_PHY;
997 /*
998 * Discard zero-length packets and packets smaller than an ACK
999 * which are not PHY_ERROR (short radar pulses have a length of 3)
1000 */
1001 if (unlikely(!rs_datalen || (rs_datalen < 10 && !is_phyerr))) {
1002 ath_warn(common,
1003 "Short RX data len, dropping (dlen: %d)\n",
1004 rs_datalen);
1005 goto rx_next;
1006 }
1007
1008 /* Get the RX status information */
1009
1010 memset(rx_status, 0, sizeof(struct ieee80211_rx_status));
1011
1012 /* Copy everything from ath_htc_rx_status (HTC_RX_FRAME_HEADER).
1013 * After this, we can drop this part of skb. */
1014 rx_status_htc_to_ath(&rx_stats, rxstatus);
1015 ath9k_htc_err_stat_rx(priv, &rx_stats);
1016 rx_status->mactime = be64_to_cpu(rxstatus->rs_tstamp);
1017 skb_pull(skb, HTC_RX_FRAME_HEADER_SIZE);
1018
1019 /*
1020 * everything but the rate is checked here, the rate check is done
1021 * separately to avoid doing two lookups for a rate for each frame.
1022 */
1023 hdr = (struct ieee80211_hdr *)skb->data;
1024
1025 /*
1026 * Process PHY errors and return so that the packet
1027 * can be dropped.
1028 */
1029 if (unlikely(is_phyerr)) {
1030 /* TODO: Not using DFS processing now. */
1031 if (ath_cmn_process_fft(&priv->spec_priv, hdr,
1032 &rx_stats, rx_status->mactime)) {
1033 /* TODO: Code to collect spectral scan statistics */
1034 }
1035 goto rx_next;
1036 }
1037
1038 if (!ath9k_cmn_rx_accept(common, hdr, rx_status, &rx_stats,
1039 &decrypt_error, priv->rxfilter))
1040 goto rx_next;
1041
1042 ath9k_cmn_rx_skb_postprocess(common, skb, &rx_stats,
1043 rx_status, decrypt_error);
1044
1045 if (ath9k_cmn_process_rate(common, hw, &rx_stats, rx_status))
1046 goto rx_next;
1047
1048 rx_stats.is_mybeacon = ath_is_mybeacon(common, hdr);
1049 ath9k_cmn_process_rssi(common, hw, &rx_stats, rx_status);
1050
1051 rx_status->band = ah->curchan->chan->band;
1052 rx_status->freq = ah->curchan->chan->center_freq;
1053 rx_status->antenna = rx_stats.rs_antenna;
1054 rx_status->flag |= RX_FLAG_MACTIME_END;
1055
1056 return true;
1057 rx_next:
1058 return false;
1059 }
1060

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip