[ardb:hctr2 3/8] crypto/hctr2.c:115:38: sparse: sparse: incorrect type in assignment (different base types)

From: kernel test robot
Date: Tue Feb 08 2022 - 17:45:09 EST


tree: git://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git hctr2
head: 5bb01649223080b7cde5740f441eb5e758ec357f
commit: 09533ad0ea8fa56420aa6e866b11c0685e862bd1 [3/8] crypto: hctr2 - Add HCTR2 support
config: sparc64-randconfig-s032-20220208 (https://download.01.org/0day-ci/archive/20220209/202202090607.wkQ2yto6-lkp@xxxxxxxxx/config)
compiler: sparc64-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/ardb/linux.git/commit/?id=09533ad0ea8fa56420aa6e866b11c0685e862bd1
git remote add ardb git://git.kernel.org/pub/scm/linux/kernel/git/ardb/linux.git
git fetch --no-tags ardb hctr2
git checkout 09533ad0ea8fa56420aa6e866b11c0685e862bd1
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=sparc64 SHELL=/bin/bash

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


sparse warnings: (new ones prefixed by >>)
>> crypto/hctr2.c:115:38: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned long long @@ got restricted __le64 [usertype] @@
crypto/hctr2.c:115:38: sparse: expected unsigned long long
crypto/hctr2.c:115:38: sparse: got restricted __le64 [usertype]
crypto/hctr2.c:117:38: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned long long @@ got restricted __le64 [usertype] @@
crypto/hctr2.c:117:38: sparse: expected unsigned long long
crypto/hctr2.c:117:38: sparse: got restricted __le64 [usertype]

vim +115 crypto/hctr2.c

103
104 static int hctr2_hash_tweak(struct skcipher_request *req, u8 *iv)
105 {
106 u64 tweak_length_part[2];
107 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
108 const struct hctr2_tfm_ctx *tctx = crypto_skcipher_ctx(tfm);
109 struct hctr2_request_ctx *rctx = skcipher_request_ctx(req);
110 struct shash_desc *hash_desc = &rctx->u.hash_desc;
111 int err;
112
113 memset(tweak_length_part, 0, sizeof(tweak_length_part));
114 if (req->cryptlen % POLYVAL_BLOCK_SIZE == 0)
> 115 tweak_length_part[0] = cpu_to_le64(TWEAK_SIZE * 8 * 2 + 2);
116 else
117 tweak_length_part[0] = cpu_to_le64(TWEAK_SIZE * 8 * 2 + 3);
118
119 hash_desc->tfm = tctx->hash;
120 err = crypto_shash_init(hash_desc);
121 if (err)
122 return err;
123
124 err = crypto_shash_update(hash_desc, (u8 *)tweak_length_part, sizeof(tweak_length_part));
125 if (err)
126 return err;
127 err = crypto_shash_update(hash_desc, iv, TWEAK_SIZE);
128 return err;
129 }
130

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