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: <202212141252.xMxV6ueV-lkp@intel.com>
Date:   Wed, 14 Dec 2022 12:25:18 +0800
From:   kernel test robot <lkp@...el.com>
To:     Kumar Kartikeya Dwivedi <memxor@...il.com>
Cc:     oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
        Alexei Starovoitov <ast@...nel.org>
Subject: drivers/block/drbd/drbd_vli.h:305:23: sparse: sparse: cast to
 restricted __le64

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   7e68dd7d07a28faa2e6574dd6b9dbd90cdeaae91
commit: 8ffa5cc142137a59d6a10eb5273fa2ba5dcd4947 bpf: Recognize lock and list fields in allocated objects
date:   4 weeks ago
config: powerpc-randconfig-s043-20221213
compiler: powerpc-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=8ffa5cc142137a59d6a10eb5273fa2ba5dcd4947
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 8ffa5cc142137a59d6a10eb5273fa2ba5dcd4947
        # 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=powerpc SHELL=/bin/bash drivers/block/

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/block/drbd/drbd_receiver.c:3146:23: sparse:    struct net_conf *
   drivers/block/drbd/drbd_receiver.c:3492:14: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/block/drbd/drbd_receiver.c:3492:14: sparse:    struct net_conf [noderef] __rcu *
   drivers/block/drbd/drbd_receiver.c:3492:14: sparse:    struct net_conf *
   drivers/block/drbd/drbd_receiver.c:3624:27: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:3625:27: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:3626:27: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:3627:27: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:3628:27: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:3629:27: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:3650:22: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/block/drbd/drbd_receiver.c:3650:22: sparse:    struct net_conf [noderef] __rcu *
   drivers/block/drbd/drbd_receiver.c:3650:22: sparse:    struct net_conf *
   drivers/block/drbd/drbd_receiver.c:3734:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/block/drbd/drbd_receiver.c:3734:9: sparse:    struct net_conf [noderef] __rcu *
   drivers/block/drbd/drbd_receiver.c:3734:9: sparse:    struct net_conf *
   drivers/block/drbd/drbd_receiver.c:3891:46: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:3949:55: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:3950:57: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:3951:56: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:3952:53: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:3986:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/block/drbd/drbd_receiver.c:3986:25: sparse:    struct net_conf [noderef] __rcu *
   drivers/block/drbd/drbd_receiver.c:3986:25: sparse:    struct net_conf *
   drivers/block/drbd/drbd_receiver.c:3991:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/block/drbd/drbd_receiver.c:3991:17: sparse:    struct disk_conf [noderef] __rcu *
   drivers/block/drbd/drbd_receiver.c:3991:17: sparse:    struct disk_conf *
   drivers/block/drbd/drbd_receiver.c:3997:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/block/drbd/drbd_receiver.c:3997:17: sparse:    struct fifo_buffer [noderef] __rcu *
   drivers/block/drbd/drbd_receiver.c:3997:17: sparse:    struct fifo_buffer *
   drivers/block/drbd/drbd_receiver.c:4064:18: sparse: sparse: cast to restricted __be64
   drivers/block/drbd/drbd_receiver.c:4065:19: sparse: sparse: cast to restricted __be64
   drivers/block/drbd/drbd_receiver.c:4066:19: sparse: sparse: cast to restricted __be64
   drivers/block/drbd/drbd_receiver.c:4074:28: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/block/drbd/drbd_receiver.c:4074:28: sparse:    struct disk_conf [noderef] __rcu *
   drivers/block/drbd/drbd_receiver.c:4074:28: sparse:    struct disk_conf *
   drivers/block/drbd/drbd_receiver.c:4115:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/block/drbd/drbd_receiver.c:4115:25: sparse:    struct disk_conf [noderef] __rcu *
   drivers/block/drbd/drbd_receiver.c:4115:25: sparse:    struct disk_conf *
   drivers/block/drbd/drbd_receiver.c:4235:29: sparse: sparse: cast to restricted __be64
   drivers/block/drbd/drbd_receiver.c:4335:18: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:4336:17: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:4361:18: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:4362:17: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:4394:24: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:4598:52: sparse: sparse: cast to restricted __be64
   drivers/block/drbd/drbd_receiver.c:4925:9: sparse: sparse: cast to restricted __be64
   drivers/block/drbd/drbd_receiver.c:4925:9: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:4943:18: sparse: sparse: cast to restricted __be64
   drivers/block/drbd/drbd_receiver.c:4944:16: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:5253:25: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] protocol_min @@     got restricted __be32 [usertype] @@
   drivers/block/drbd/drbd_receiver.c:5254:25: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] protocol_max @@     got restricted __be32 [usertype] @@
   drivers/block/drbd/drbd_receiver.c:5255:26: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] feature_flags @@     got restricted __be32 [usertype] @@
   drivers/block/drbd/drbd_receiver.c:5561:23: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:5580:23: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:5625:27: sparse: sparse: cast to restricted __be64
   drivers/block/drbd/drbd_receiver.c:5626:23: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:5635:38: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:5677:27: sparse: sparse: cast to restricted __be64
   drivers/block/drbd/drbd_receiver.c:5678:23: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:5686:38: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:5723:27: sparse: sparse: cast to restricted __be64
   drivers/block/drbd/drbd_receiver.c:5724:20: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:5732:38: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:5759:27: sparse: sparse: cast to restricted __be64
   drivers/block/drbd/drbd_receiver.c:5766:38: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:5768:9: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:5768:9: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:5768:9: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:5768:9: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:5789:18: sparse: sparse: cast to restricted __be64
   drivers/block/drbd/drbd_receiver.c:5790:16: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:5792:38: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:5819:44: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:5851:18: sparse: sparse: cast to restricted __be64
   drivers/block/drbd/drbd_receiver.c:5852:16: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:5854:38: sparse: sparse: cast to restricted __be32
   drivers/block/drbd/drbd_receiver.c:5856:13: sparse: sparse: cast to restricted __be64
   drivers/block/drbd/drbd_receiver.c:5905:14: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/block/drbd/drbd_receiver.c:5905:14: sparse:    struct net_conf [noderef] __rcu *
   drivers/block/drbd/drbd_receiver.c:5905:14: sparse:    struct net_conf *
   drivers/block/drbd/drbd_receiver.c:5995:37: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/block/drbd/drbd_receiver.c:5995:37: sparse:    struct net_conf [noderef] __rcu *
   drivers/block/drbd/drbd_receiver.c:5995:37: sparse:    struct net_conf *
   drivers/block/drbd/drbd_receiver.c:6092:14: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/block/drbd/drbd_receiver.c:6092:14: sparse:    struct net_conf [noderef] __rcu *
   drivers/block/drbd/drbd_receiver.c:6092:14: sparse:    struct net_conf *
   drivers/block/drbd/drbd_receiver.c:1269:9: sparse: sparse: context imbalance in 'one_flush_endio' - unexpected unlock
   drivers/block/drbd/drbd_receiver.c:1287:17: sparse: sparse: context imbalance in 'submit_one_flush' - unexpected unlock
   drivers/block/drbd/drbd_receiver.c:1322:17: sparse: sparse: context imbalance in 'drbd_flush' - different lock contexts for basic block
   drivers/block/drbd/drbd_receiver.c:1462:9: sparse: sparse: context imbalance in 'drbd_bump_write_ordering' - different lock contexts for basic block
   drivers/block/drbd/drbd_receiver.c:1696:17: sparse: sparse: context imbalance in 'drbd_submit_peer_request' - unexpected unlock
   drivers/block/drbd/drbd_receiver.c:2037:12: sparse: sparse: context imbalance in 'recv_resync_read' - wrong count at exit
   drivers/block/drbd/drbd_receiver.c:2413:17: sparse: sparse: context imbalance in 'fail_postponed_requests' - unexpected unlock
   drivers/block/drbd/drbd_receiver.c:2532:12: sparse: sparse: context imbalance in 'receive_Data' - different lock contexts for basic block
   drivers/block/drbd/drbd_receiver.c:2783:12: sparse: sparse: context imbalance in 'receive_DataRequest' - different lock contexts for basic block
   drivers/block/drbd/drbd_receiver.c:4014:9: sparse: sparse: context imbalance in 'receive_SyncParam' - different lock contexts for basic block
   drivers/block/drbd/drbd_receiver.c:4194:9: sparse: sparse: context imbalance in 'receive_sizes' - different lock contexts for basic block
   drivers/block/drbd/drbd_receiver.c:4527:22: sparse: sparse: context imbalance in 'receive_state' - different lock contexts for basic block
   drivers/block/drbd/drbd_receiver.c: note: in included file:
>> drivers/block/drbd/drbd_vli.h:305:23: sparse: sparse: cast to restricted __le64
>> drivers/block/drbd/drbd_vli.h:305:23: sparse: sparse: cast to restricted __le64
   drivers/block/drbd/drbd_receiver.c:4992:19: sparse: sparse: context imbalance in 'receive_rs_deallocated' - different lock contexts for basic block

vim +305 drivers/block/drbd/drbd_vli.h

b411b3637fa71fc Philipp Reisner 2009-09-25  271  
b411b3637fa71fc Philipp Reisner 2009-09-25  272  /* Fetch (at most 64) bits from bitstream into *out, and advance cursor.
b411b3637fa71fc Philipp Reisner 2009-09-25  273   *
b411b3637fa71fc Philipp Reisner 2009-09-25  274   * If more than 64 bits are requested, returns -EINVAL and leave *out unchanged.
b411b3637fa71fc Philipp Reisner 2009-09-25  275   *
b411b3637fa71fc Philipp Reisner 2009-09-25  276   * If there are less than the requested number of valid bits left in the
b411b3637fa71fc Philipp Reisner 2009-09-25  277   * bitstream, still fetches all available bits.
b411b3637fa71fc Philipp Reisner 2009-09-25  278   *
b411b3637fa71fc Philipp Reisner 2009-09-25  279   * Returns number of actually fetched bits.
b411b3637fa71fc Philipp Reisner 2009-09-25  280   */
b411b3637fa71fc Philipp Reisner 2009-09-25  281  static inline int bitstream_get_bits(struct bitstream *bs, u64 *out, int bits)
b411b3637fa71fc Philipp Reisner 2009-09-25  282  {
b411b3637fa71fc Philipp Reisner 2009-09-25  283  	u64 val;
b411b3637fa71fc Philipp Reisner 2009-09-25  284  	unsigned int n;
b411b3637fa71fc Philipp Reisner 2009-09-25  285  
b411b3637fa71fc Philipp Reisner 2009-09-25  286  	if (bits > 64)
b411b3637fa71fc Philipp Reisner 2009-09-25  287  		return -EINVAL;
b411b3637fa71fc Philipp Reisner 2009-09-25  288  
b411b3637fa71fc Philipp Reisner 2009-09-25  289  	if (bs->cur.b + ((bs->cur.bit + bs->pad_bits + bits -1) >> 3) - bs->buf >= bs->buf_len)
b411b3637fa71fc Philipp Reisner 2009-09-25  290  		bits = ((bs->buf_len - (bs->cur.b - bs->buf)) << 3)
b411b3637fa71fc Philipp Reisner 2009-09-25  291  			- bs->cur.bit - bs->pad_bits;
b411b3637fa71fc Philipp Reisner 2009-09-25  292  
b411b3637fa71fc Philipp Reisner 2009-09-25  293  	if (bits == 0) {
b411b3637fa71fc Philipp Reisner 2009-09-25  294  		*out = 0;
b411b3637fa71fc Philipp Reisner 2009-09-25  295  		return 0;
b411b3637fa71fc Philipp Reisner 2009-09-25  296  	}
b411b3637fa71fc Philipp Reisner 2009-09-25  297  
b411b3637fa71fc Philipp Reisner 2009-09-25  298  	/* get the high bits */
b411b3637fa71fc Philipp Reisner 2009-09-25  299  	val = 0;
b411b3637fa71fc Philipp Reisner 2009-09-25  300  	n = (bs->cur.bit + bits + 7) >> 3;
b411b3637fa71fc Philipp Reisner 2009-09-25  301  	/* n may be at most 9, if cur.bit + bits > 64 */
b411b3637fa71fc Philipp Reisner 2009-09-25  302  	/* which means this copies at most 8 byte */
b411b3637fa71fc Philipp Reisner 2009-09-25  303  	if (n) {
b411b3637fa71fc Philipp Reisner 2009-09-25  304  		memcpy(&val, bs->cur.b+1, n - 1);
b411b3637fa71fc Philipp Reisner 2009-09-25 @305  		val = le64_to_cpu(val) << (8 - bs->cur.bit);
b411b3637fa71fc Philipp Reisner 2009-09-25  306  	}
b411b3637fa71fc Philipp Reisner 2009-09-25  307  
b411b3637fa71fc Philipp Reisner 2009-09-25  308  	/* we still need the low bits */
b411b3637fa71fc Philipp Reisner 2009-09-25  309  	val |= bs->cur.b[0] >> bs->cur.bit;
b411b3637fa71fc Philipp Reisner 2009-09-25  310  
b411b3637fa71fc Philipp Reisner 2009-09-25  311  	/* and mask out bits we don't want */
b411b3637fa71fc Philipp Reisner 2009-09-25  312  	val &= ~0ULL >> (64 - bits);
b411b3637fa71fc Philipp Reisner 2009-09-25  313  
b411b3637fa71fc Philipp Reisner 2009-09-25  314  	bitstream_cursor_advance(&bs->cur, bits);
b411b3637fa71fc Philipp Reisner 2009-09-25  315  	*out = val;
b411b3637fa71fc Philipp Reisner 2009-09-25  316  
b411b3637fa71fc Philipp Reisner 2009-09-25  317  	return bits;
b411b3637fa71fc Philipp Reisner 2009-09-25  318  }
b411b3637fa71fc Philipp Reisner 2009-09-25  319  

:::::: The code at line 305 was first introduced by commit
:::::: b411b3637fa71fce9cf2acf0639009500f5892fe The DRBD driver

:::::: TO: Philipp Reisner <philipp.reisner@...bit.com>
:::::: CC: Jens Axboe <jens.axboe@...cle.com>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ