Re: [PATCH 1/2] staging: net: wireless: add ESP8089 WiFi driver

From: kbuild test robot
Date: Sun Jul 23 2017 - 03:18:35 EST


Hi Quentin,

[auto build test WARNING on next-20170719]
[cannot apply to staging/staging-testing linus/master linux/master v4.13-rc1 v4.12 v4.12-rc7 v4.13-rc1]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Quentin-Schulz/add-ESP8089-WiFi-chip-driver/20170723-143744
config: blackfin-allyesconfig (attached as .config)
compiler: bfin-uclinux-gcc (GCC) 6.2.0
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=blackfin

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

drivers/staging//esp8089/esp_sip.c: In function 'sip_txq_process':
>> drivers/staging//esp8089/esp_sip.c:797:32: warning: 'offset' may be used uninitialized in this function [-Wmaybe-uninitialized]
memcpy(sip->tx_aggr_write_ptr + offset, skb->data, skb->len);
~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
drivers/staging//esp8089/esp_sip.c:700:14: note: 'offset' was declared here
u32 tx_len, offset;
^~~~~~
drivers/staging//esp8089/esp_sip.c: In function 'sip_poll_resetting_event':
>> drivers/staging//esp8089/esp_sip.c:1662:5: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (!ret) {
^
--
drivers/staging//esp8089/esp_mac80211.c: In function 'esp_op_set_key':
>> drivers/staging//esp8089/esp_mac80211.c:529:6: warning: 'index' may be used uninitialized in this function [-Wmaybe-uninitialized]
map[index].flag = 0;
^

vim +/offset +797 drivers/staging//esp8089/esp_sip.c

691
692 /* setup sip header and tx info, copy pkt into aggr buf */
693 static int sip_pack_pkt(struct esp_sip *sip, struct sk_buff *skb, int *pm_state)
694 {
695 struct ieee80211_tx_info *itx_info;
696 struct sip_hdr *shdr;
697 struct ieee80211_hdr *wh;
698 struct esp_vif *evif;
699 struct esp_node *node;
700 u32 tx_len, offset;
701 bool is_data = true;
702 u8 sta_index;
703 int alg;
704
705 itx_info = IEEE80211_SKB_CB(skb);
706 if (itx_info->flags == 0xffffffff) {
707 shdr = (struct sip_hdr *)skb->data;
708 is_data = false;
709 tx_len = skb->len;
710 } else {
711 wh = (struct ieee80211_hdr *)skb->data;
712 evif = (struct esp_vif *)itx_info->control.vif->drv_priv;
713 /* update sip header */
714 shdr = (struct sip_hdr *)sip->tx_aggr_write_ptr;
715
716 shdr->fc[0] = 0;
717 shdr->fc[1] = 0;
718
719 if (itx_info->flags & IEEE80211_TX_CTL_AMPDU)
720 SIP_HDR_SET_TYPE(shdr->fc[0], SIP_DATA_AMPDU);
721 else
722 SIP_HDR_SET_TYPE(shdr->fc[0], SIP_DATA);
723
724 if (!evif->epub) {
725 sip_tx_status_report(sip, skb, itx_info, false);
726 atomic_dec(&sip->tx_data_pkt_queued);
727 return -EINVAL;
728 }
729
730 /* make room for encrypted pkt */
731 if (itx_info->control.hw_key) {
732 alg = esp_cipher2alg(itx_info->control.hw_key->cipher);
733 if (unlikely(alg == -1)) {
734 sip_tx_status_report(sip, skb, itx_info, false);
735 atomic_dec(&sip->tx_data_pkt_queued);
736 return -1;
737 }
738
739 shdr->d_enc_flag = alg + 1;
740 shdr->d_hw_kid = itx_info->control.hw_key->hw_key_idx |
741 (evif->index << 7);
742 } else {
743 shdr->d_enc_flag = 0;
744 shdr->d_hw_kid = evif->index << 7 | evif->index;
745 }
746
747 /* update sip tx info */
748 node = esp_get_node_by_addr(sip->epub, wh->addr1);
749 if (node)
750 sta_index = node->index;
751 else
752 sta_index = ESP_PUB_MAX_STA + 1;
753
754 SIP_HDR_SET_IFIDX(shdr->fc[0], evif->index << 3 | sta_index);
755 shdr->d_p2p = itx_info->control.vif->p2p;
756
757 if (evif->index == 1)
758 shdr->d_p2p = 1;
759
760 shdr->d_ac = skb_get_queue_mapping(skb);
761 shdr->d_tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
762
763 wh = (struct ieee80211_hdr *)skb->data;
764
765 if (ieee80211_is_mgmt(wh->frame_control)) {
766 /* addba/delba/bar may use different tid/ac */
767 if (shdr->d_ac == WME_AC_VO)
768 shdr->d_tid = 7;
769
770 if (ieee80211_is_beacon(wh->frame_control)) {
771 shdr->d_tid = 8;
772 shdr->d_ac = 4;
773 }
774 }
775
776 if (check_ac_tid(skb->data, shdr->d_ac, shdr->d_tid)) {
777 shdr->d_ac = WME_AC_BE;
778 shdr->d_tid = 0;
779 }
780
781 /* make sure data is start at 4 bytes aligned addr. */
782 offset = roundup(sizeof(struct sip_hdr), 4);
783
784 if (SIP_HDR_IS_AMPDU(shdr)) {
785 memset(sip->tx_aggr_write_ptr + offset, 0,
786 sizeof(struct esp_tx_ampdu_entry));
787 offset += roundup(sizeof(struct esp_tx_ampdu_entry), 4);
788 }
789
790 tx_len = offset + skb->len;
791 shdr->len = tx_len; /* actual len */
792 }
793
794 shdr->seq = sip->txseq++;
795
796 /* copy skb to aggr buf */
> 797 memcpy(sip->tx_aggr_write_ptr + offset, skb->data, skb->len);
798
799 if (is_data) {
800 spin_lock_bh(&sip->epub->tx_lock);
801 sip->txdataseq = shdr->seq;
802 spin_unlock_bh(&sip->epub->tx_lock);
803
804 /* fake a tx_status and report to mac80211 stack to speed up tx, may affect
805 * 1) rate control (now it's all in target, so should be OK)
806 * 2) ps mode, mac80211 want to check ACK of ps/nulldata to see if AP is awake
807 * 3) BAR, mac80211 do BAR by checking ACK
808 *
809 * XXX: need to adjust for 11n, e.g. report tx_status according to BA received in target
810 */
811 sip_tx_status_report(sip, skb, itx_info, true);
812 atomic_dec(&sip->tx_data_pkt_queued);
813
814 STRACE_TX_DATA_INC();
815 } else {
816 /* check pm state here */
817
818 /* no need to hold ctrl skb */
819 sip_free_ctrl_skbuff(sip, skb);
820 STRACE_TX_CMD_INC();
821 }
822
823 /* TBD: roundup here or whole aggr-buf */
824 tx_len = roundup(tx_len, sip->tx_blksz);
825
826 sip->tx_aggr_write_ptr += tx_len;
827 sip->tx_tot_len += tx_len;
828
829 return 0;
830 }
831

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip