lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202112020449.FNKDxUVp-lkp@intel.com>
Date:   Thu, 2 Dec 2021 04:51:48 +0800
From:   kernel test robot <lkp@...el.com>
To:     Loic Poulain <loic.poulain@...aro.org>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Kalle Valo <kvalo@...eaurora.org>
Subject: drivers/net/wireless/ath/wcn36xx/smd.c:943:33: sparse: sparse: cast
 truncates bits from constant value (780 becomes 80)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   58e1100fdc5990b0cc0d4beaf2562a92e621ac7d
commit: d707f812bb0513ea0030d0c9fe2a456bae5a4583 wcn36xx: Channel list update before hardware scan
date:   5 weeks ago
config: riscv-randconfig-s031-20211201 (https://download.01.org/0day-ci/archive/20211202/202112020449.FNKDxUVp-lkp@intel.com/config)
compiler: riscv32-linux-gcc (GCC) 11.2.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.4-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d707f812bb0513ea0030d0c9fe2a456bae5a4583
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout d707f812bb0513ea0030d0c9fe2a456bae5a4583
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=riscv SHELL=/bin/bash drivers/net/wireless/ath/wcn36xx/

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


sparse warnings: (new ones prefixed by >>)
>> drivers/net/wireless/ath/wcn36xx/smd.c:943:33: sparse: sparse: cast truncates bits from constant value (780 becomes 80)

vim +943 drivers/net/wireless/ath/wcn36xx/smd.c

   931	
   932	int wcn36xx_smd_update_channel_list(struct wcn36xx *wcn, struct cfg80211_scan_request *req)
   933	{
   934		struct wcn36xx_hal_update_channel_list_req_msg *msg_body;
   935		int ret, i;
   936	
   937		msg_body = kzalloc(sizeof(*msg_body), GFP_KERNEL);
   938		if (!msg_body)
   939			return -ENOMEM;
   940	
   941		INIT_HAL_MSG((*msg_body), WCN36XX_HAL_UPDATE_CHANNEL_LIST_REQ);
   942	
 > 943		msg_body->num_channel = min_t(u8, req->n_channels, sizeof(msg_body->channels));
   944		for (i = 0; i < msg_body->num_channel; i++) {
   945			struct wcn36xx_hal_channel_param *param = &msg_body->channels[i];
   946			u32 min_power = WCN36XX_HAL_DEFAULT_MIN_POWER;
   947			u32 ant_gain = WCN36XX_HAL_DEFAULT_ANT_GAIN;
   948	
   949			param->mhz = req->channels[i]->center_freq;
   950			param->band_center_freq1 = req->channels[i]->center_freq;
   951			param->band_center_freq2 = 0;
   952	
   953			if (req->channels[i]->flags & IEEE80211_CHAN_NO_IR)
   954				param->channel_info |= WCN36XX_HAL_CHAN_INFO_FLAG_PASSIVE;
   955	
   956			if (req->channels[i]->flags & IEEE80211_CHAN_RADAR)
   957				param->channel_info |= WCN36XX_HAL_CHAN_INFO_FLAG_DFS;
   958	
   959			if (req->channels[i]->band == NL80211_BAND_5GHZ) {
   960				param->channel_info |= WCN36XX_HAL_CHAN_INFO_FLAG_HT;
   961				param->channel_info |= WCN36XX_HAL_CHAN_INFO_FLAG_VHT;
   962				param->channel_info |= WCN36XX_HAL_CHAN_INFO_PHY_11A;
   963			} else {
   964				param->channel_info |= WCN36XX_HAL_CHAN_INFO_PHY_11BG;
   965			}
   966	
   967			if (min_power > req->channels[i]->max_power)
   968				min_power = req->channels[i]->max_power;
   969	
   970			if (req->channels[i]->max_antenna_gain)
   971				ant_gain = req->channels[i]->max_antenna_gain;
   972	
   973			u32p_replace_bits(&param->reg_info_1, min_power,
   974					  WCN36XX_HAL_CHAN_REG1_MIN_PWR_MASK);
   975			u32p_replace_bits(&param->reg_info_1, req->channels[i]->max_power,
   976					  WCN36XX_HAL_CHAN_REG1_MAX_PWR_MASK);
   977			u32p_replace_bits(&param->reg_info_1, req->channels[i]->max_reg_power,
   978					  WCN36XX_HAL_CHAN_REG1_REG_PWR_MASK);
   979			u32p_replace_bits(&param->reg_info_1, 0,
   980					  WCN36XX_HAL_CHAN_REG1_CLASS_ID_MASK);
   981			u32p_replace_bits(&param->reg_info_2, ant_gain,
   982					  WCN36XX_HAL_CHAN_REG2_ANT_GAIN_MASK);
   983	
   984			wcn36xx_dbg(WCN36XX_DBG_HAL,
   985				    "%s: freq=%u, channel_info=%08x, reg_info1=%08x, reg_info2=%08x\n",
   986				    __func__, param->mhz, param->channel_info, param->reg_info_1,
   987				    param->reg_info_2);
   988		}
   989	
   990		mutex_lock(&wcn->hal_mutex);
   991	
   992		PREPARE_HAL_BUF(wcn->hal_buf, (*msg_body));
   993	
   994		ret = wcn36xx_smd_send_and_wait(wcn, msg_body->header.len);
   995		if (ret) {
   996			wcn36xx_err("Sending hal_update_channel_list failed\n");
   997			goto out;
   998		}
   999	
  1000		ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
  1001		if (ret) {
  1002			wcn36xx_err("hal_update_channel_list response failed err=%d\n", ret);
  1003			goto out;
  1004		}
  1005	
  1006	out:
  1007		kfree(msg_body);
  1008		mutex_unlock(&wcn->hal_mutex);
  1009		return ret;
  1010	}
  1011	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ