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: <202301061712.QqhzXoOM-lkp@intel.com>
Date:   Fri, 6 Jan 2023 17:59:10 +0800
From:   kernel test robot <lkp@...el.com>
To:     Huang Yiwei <quic_hyiwei@...cinc.com>
Cc:     oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
        Georgi Djakov <djakov@...nel.org>,
        Bjorn Andersson <andersson@...nel.org>
Subject: drivers/interconnect/qcom/bcm-voter.c:72:77: sparse: sparse:
 restricted __le16 degrades to integer

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   1f5abbd77e2c1787e74b7c2caffac97def78ba52
commit: 7aa429e8d40ed7e8ab3c0ff5e2836c051ab2434a interconnect: qcom: Kconfig: Make INTERCONNECT_QCOM tristate
date:   4 months ago
config: arm64-randconfig-s043-20230106
compiler: aarch64-linux-gcc (GCC) 12.1.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-39-gce1a6720-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7aa429e8d40ed7e8ab3c0ff5e2836c051ab2434a
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 7aa429e8d40ed7e8ab3c0ff5e2836c051ab2434a
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm64 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/interconnect/qcom/

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

sparse warnings: (new ones prefixed by >>)
>> drivers/interconnect/qcom/bcm-voter.c:72:77: sparse: sparse: restricted __le16 degrades to integer
   drivers/interconnect/qcom/bcm-voter.c:76:78: sparse: sparse: restricted __le16 degrades to integer
>> drivers/interconnect/qcom/bcm-voter.c:82:66: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected unsigned int [usertype] base @@     got restricted __le32 [usertype] unit @@
   drivers/interconnect/qcom/bcm-voter.c:82:66: sparse:     expected unsigned int [usertype] base
   drivers/interconnect/qcom/bcm-voter.c:82:66: sparse:     got restricted __le32 [usertype] unit
   drivers/interconnect/qcom/bcm-voter.c:85:66: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected unsigned int [usertype] base @@     got restricted __le32 [usertype] unit @@
   drivers/interconnect/qcom/bcm-voter.c:85:66: sparse:     expected unsigned int [usertype] base
   drivers/interconnect/qcom/bcm-voter.c:85:66: sparse:     got restricted __le32 [usertype] unit
>> drivers/interconnect/qcom/bcm-voter.c:117:21: sparse: sparse: restricted __le32 degrades to integer
>> drivers/interconnect/qcom/bcm-voter.c:117:21: sparse: sparse: restricted __le32 degrades to integer
--
>> drivers/interconnect/qcom/icc-rpmh.c:141:28: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [usertype] unit @@     got unsigned int [usertype] @@
   drivers/interconnect/qcom/icc-rpmh.c:141:28: sparse:     expected restricted __le32 [usertype] unit
   drivers/interconnect/qcom/icc-rpmh.c:141:28: sparse:     got unsigned int [usertype]
>> drivers/interconnect/qcom/icc-rpmh.c:142:29: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le16 [usertype] width @@     got unsigned short [usertype] @@
   drivers/interconnect/qcom/icc-rpmh.c:142:29: sparse:     expected restricted __le16 [usertype] width
   drivers/interconnect/qcom/icc-rpmh.c:142:29: sparse:     got unsigned short [usertype]

vim +72 drivers/interconnect/qcom/bcm-voter.c

91e045b93db79a Mike Tipton 2020-09-03   60  
976daac4a1c581 David Dai   2020-02-28   61  static void bcm_aggregate(struct qcom_icc_bcm *bcm)
976daac4a1c581 David Dai   2020-02-28   62  {
91e045b93db79a Mike Tipton 2020-09-03   63  	struct qcom_icc_node *node;
976daac4a1c581 David Dai   2020-02-28   64  	size_t i, bucket;
976daac4a1c581 David Dai   2020-02-28   65  	u64 agg_avg[QCOM_ICC_NUM_BUCKETS] = {0};
976daac4a1c581 David Dai   2020-02-28   66  	u64 agg_peak[QCOM_ICC_NUM_BUCKETS] = {0};
976daac4a1c581 David Dai   2020-02-28   67  	u64 temp;
976daac4a1c581 David Dai   2020-02-28   68  
976daac4a1c581 David Dai   2020-02-28   69  	for (bucket = 0; bucket < QCOM_ICC_NUM_BUCKETS; bucket++) {
976daac4a1c581 David Dai   2020-02-28   70  		for (i = 0; i < bcm->num_nodes; i++) {
91e045b93db79a Mike Tipton 2020-09-03   71  			node = bcm->nodes[i];
91e045b93db79a Mike Tipton 2020-09-03  @72  			temp = bcm_div(node->sum_avg[bucket] * bcm->aux_data.width,
91e045b93db79a Mike Tipton 2020-09-03   73  				       node->buswidth * node->channels);
976daac4a1c581 David Dai   2020-02-28   74  			agg_avg[bucket] = max(agg_avg[bucket], temp);
976daac4a1c581 David Dai   2020-02-28   75  
91e045b93db79a Mike Tipton 2020-09-03   76  			temp = bcm_div(node->max_peak[bucket] * bcm->aux_data.width,
91e045b93db79a Mike Tipton 2020-09-03   77  				       node->buswidth);
976daac4a1c581 David Dai   2020-02-28   78  			agg_peak[bucket] = max(agg_peak[bucket], temp);
976daac4a1c581 David Dai   2020-02-28   79  		}
976daac4a1c581 David Dai   2020-02-28   80  
cb30e0292db258 Mike Tipton 2020-09-03   81  		temp = agg_avg[bucket] * bcm->vote_scale;
91e045b93db79a Mike Tipton 2020-09-03  @82  		bcm->vote_x[bucket] = bcm_div(temp, bcm->aux_data.unit);
976daac4a1c581 David Dai   2020-02-28   83  
cb30e0292db258 Mike Tipton 2020-09-03   84  		temp = agg_peak[bucket] * bcm->vote_scale;
91e045b93db79a Mike Tipton 2020-09-03   85  		bcm->vote_y[bucket] = bcm_div(temp, bcm->aux_data.unit);
976daac4a1c581 David Dai   2020-02-28   86  	}
976daac4a1c581 David Dai   2020-02-28   87  
976daac4a1c581 David Dai   2020-02-28   88  	if (bcm->keepalive && bcm->vote_x[QCOM_ICC_BUCKET_AMC] == 0 &&
976daac4a1c581 David Dai   2020-02-28   89  	    bcm->vote_y[QCOM_ICC_BUCKET_AMC] == 0) {
976daac4a1c581 David Dai   2020-02-28   90  		bcm->vote_x[QCOM_ICC_BUCKET_AMC] = 1;
976daac4a1c581 David Dai   2020-02-28   91  		bcm->vote_x[QCOM_ICC_BUCKET_WAKE] = 1;
976daac4a1c581 David Dai   2020-02-28   92  		bcm->vote_y[QCOM_ICC_BUCKET_AMC] = 1;
976daac4a1c581 David Dai   2020-02-28   93  		bcm->vote_y[QCOM_ICC_BUCKET_WAKE] = 1;
976daac4a1c581 David Dai   2020-02-28   94  	}
976daac4a1c581 David Dai   2020-02-28   95  }
976daac4a1c581 David Dai   2020-02-28   96  
976daac4a1c581 David Dai   2020-02-28   97  static inline void tcs_cmd_gen(struct tcs_cmd *cmd, u64 vote_x, u64 vote_y,
b92902fddf4200 Mike Tipton 2020-09-03   98  			       u32 addr, bool commit, bool wait)
976daac4a1c581 David Dai   2020-02-28   99  {
976daac4a1c581 David Dai   2020-02-28  100  	bool valid = true;
976daac4a1c581 David Dai   2020-02-28  101  
976daac4a1c581 David Dai   2020-02-28  102  	if (!cmd)
976daac4a1c581 David Dai   2020-02-28  103  		return;
976daac4a1c581 David Dai   2020-02-28  104  
9c0c54a8daf465 Mike Tipton 2020-04-15  105  	memset(cmd, 0, sizeof(*cmd));
9c0c54a8daf465 Mike Tipton 2020-04-15  106  
976daac4a1c581 David Dai   2020-02-28  107  	if (vote_x == 0 && vote_y == 0)
976daac4a1c581 David Dai   2020-02-28  108  		valid = false;
976daac4a1c581 David Dai   2020-02-28  109  
976daac4a1c581 David Dai   2020-02-28  110  	if (vote_x > BCM_TCS_CMD_VOTE_MASK)
976daac4a1c581 David Dai   2020-02-28  111  		vote_x = BCM_TCS_CMD_VOTE_MASK;
976daac4a1c581 David Dai   2020-02-28  112  
976daac4a1c581 David Dai   2020-02-28  113  	if (vote_y > BCM_TCS_CMD_VOTE_MASK)
976daac4a1c581 David Dai   2020-02-28  114  		vote_y = BCM_TCS_CMD_VOTE_MASK;
976daac4a1c581 David Dai   2020-02-28  115  
976daac4a1c581 David Dai   2020-02-28  116  	cmd->addr = addr;
976daac4a1c581 David Dai   2020-02-28 @117  	cmd->data = BCM_TCS_CMD(commit, valid, vote_x, vote_y);
976daac4a1c581 David Dai   2020-02-28  118  
976daac4a1c581 David Dai   2020-02-28  119  	/*
976daac4a1c581 David Dai   2020-02-28  120  	 * Set the wait for completion flag on command that need to be completed
976daac4a1c581 David Dai   2020-02-28  121  	 * before the next command.
976daac4a1c581 David Dai   2020-02-28  122  	 */
b92902fddf4200 Mike Tipton 2020-09-03  123  	cmd->wait = wait;
976daac4a1c581 David Dai   2020-02-28  124  }
976daac4a1c581 David Dai   2020-02-28  125  

:::::: The code at line 72 was first introduced by commit
:::::: 91e045b93db79a2ef66e045ad0d1f8f9d348e1f4 interconnect: qcom: Fix small BW votes being truncated to zero

:::::: TO: Mike Tipton <mdtipton@...eaurora.org>
:::::: CC: Georgi Djakov <georgi.djakov@...aro.org>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

View attachment "config" of type "text/plain" (179810 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ