[ath6kl:pending 39/39] drivers/net/wireless/ath/wcn36xx/testmode.c:122:5: warning: 'msg' may be used uninitialized in this function

kbuild test robot fengguang.wu at intel.com
Wed Feb 28 08:56:19 PST 2018


tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git pending
head:   54520396c47a365ad60d539fab64fde5abccedad
commit: 54520396c47a365ad60d539fab64fde5abccedad [39/39] wcn36xx: Add support for FTM WLAN
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 54520396c47a365ad60d539fab64fde5abccedad
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

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/net/wireless/ath/wcn36xx/testmode.c: In function 'wcn36xx_tm_cmd':
>> drivers/net/wireless/ath/wcn36xx/testmode.c:122:5: warning: 'msg' may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (rsp != msg)
        ^
   drivers/net/wireless/ath/wcn36xx/testmode.c:44:22: note: 'msg' was declared here
     struct ftm_rsp_msg *msg, *rsp = NULL;
                         ^~~

vim +/msg +122 drivers/net/wireless/ath/wcn36xx/testmode.c

    38	
    39	static int wcn36xx_tm_cmd_ptt(struct wcn36xx *wcn, struct ieee80211_vif *vif,
    40					struct nlattr *tb[])
    41	{
    42		int ret = 0, buf_len;
    43		void *buf;
    44		struct ftm_rsp_msg *msg, *rsp = NULL;
    45		struct sk_buff *skb;
    46	
    47		if (!tb[WCN36XX_TM_ATTR_DATA]) {
    48			ret = -EINVAL;
    49			goto out;
    50		}
    51	
    52		buf = nla_data(tb[WCN36XX_TM_ATTR_DATA]);
    53		buf_len = nla_len(tb[WCN36XX_TM_ATTR_DATA]);
    54		msg = (struct ftm_rsp_msg *)buf;
    55	
    56		wcn36xx_dbg(WCN36XX_DBG_TESTMODE,
    57			   "testmode cmd wmi msg_id 0x%04X msg_len %d buf %pK buf_len %d\n",
    58			   msg->msg_id, msg->msg_body_length,
    59			   buf, buf_len);
    60	
    61		wcn36xx_dbg_dump(WCN36XX_DBG_TESTMODE_DUMP, "REQ ", buf, buf_len);
    62	
    63		switch (msg->msg_id) {
    64		case MSG_GET_BUILD_RELEASE_NUMBER: {
    65			struct build_release_number *body =
    66					(struct build_release_number *)
    67					msg->msg_response;
    68	
    69			body->drv_major = wcn->fw_major;
    70			body->drv_minor = wcn->fw_minor;
    71			body->drv_patch = wcn->fw_version;
    72			body->drv_build = wcn->fw_revision;
    73			body->ptt_max = 10;
    74			body->ptt_min = 0;
    75	
    76			rsp = msg;
    77			rsp->resp_status = 0;
    78			break;
    79		}
    80		default:
    81			wcn36xx_dbg(WCN36XX_DBG_TESTMODE,
    82					"PPT Request >> HAL size %d\n",
    83					msg->msg_body_length);
    84	
    85			msg->resp_status = wcn36xx_smd_process_ptt_msg(wcn, vif, msg,
    86					msg->msg_body_length, (void *)(&rsp));
    87	
    88			wcn36xx_dbg(WCN36XX_DBG_TESTMODE,
    89					"Response status = %d\n",
    90					msg->resp_status);
    91			if (rsp)
    92				wcn36xx_dbg(WCN36XX_DBG_TESTMODE,
    93						"PPT Response << HAL size %d\n",
    94						rsp->msg_body_length);
    95			break;
    96		}
    97	
    98		if (!rsp) {
    99			rsp = msg;
   100			wcn36xx_warn("No response! Echoing request with response status %d\n",
   101					rsp->resp_status);
   102		}
   103		wcn36xx_dbg_dump(WCN36XX_DBG_TESTMODE_DUMP, "RSP ",
   104				rsp, rsp->msg_body_length);
   105	
   106		skb = cfg80211_testmode_alloc_reply_skb(wcn->hw->wiphy,
   107					nla_total_size(msg->msg_body_length));
   108		if (!skb) {
   109			ret = -ENOMEM;
   110			goto out;
   111		}
   112	
   113		ret = nla_put(skb, WCN36XX_TM_ATTR_DATA, rsp->msg_body_length, rsp);
   114		if (ret) {
   115			kfree_skb(skb);
   116			goto out;
   117		}
   118	
   119		ret = cfg80211_testmode_reply(skb);
   120	
   121	out:
 > 122		if (rsp != msg)
   123			kfree(rsp);
   124	
   125		return ret;
   126	}
   127	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 53236 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/ath10k/attachments/20180301/cc408077/attachment-0001.gz>


More information about the ath10k mailing list