Re: [PATCH v2 2/2] crypto: hisilicon/advca - Add SHA support

kernel test robot
2023-05-13T09:06:18Z

Hi David,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 9a48d604672220545d209e9996c2a1edbb5637f6]

url: https://github.com/intel-lab-lkp/linux/commits/David-Yang/crypto-hisilicon-Add-HiSilicon-ADVCA-Subsystem/20230513-154545
base: 9a48d604672220545d209e9996c2a1edbb5637f6
patch link: https://lore.kernel.org/r/20230513074339.266879-3-mmyangfl%40gmail.com
patch subject: [PATCH v2 2/2] crypto: hisilicon/advca - Add SHA support
config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20230513/202305131617.8wrECG3g-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/57ff91a10a13d90fadb0567f9245d9040ce9659e
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review David-Yang/crypto-hisilicon-Add-HiSilicon-ADVCA-Subsystem/20230513-154545
git checkout 57ff91a10a13d90fadb0567f9245d9040ce9659e
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=loongarch olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=loongarch SHELL=/bin/bash drivers/crypto/hisilicon/advca/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202305131617.8wrECG3g-lkp@intel.com/

All warnings (new ones prefixed by >>):

drivers/crypto/hisilicon/advca/hisi-advca-sha.c: In function 'hica_sha_update':
>> drivers/crypto/hisilicon/advca/hisi-advca-sha.c:216:26: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
216 | bool inplace = !((unsigned int) data & 3);
| ^

vim +216 drivers/crypto/hisilicon/advca/hisi-advca-sha.c

211
212 static int hica_sha_update(const struct hica_sha_priv *priv, const void *data,
213 unsigned int len, bool may_sleep)
214 {
215 struct device *dev = priv->dev;
> 216 bool inplace = !((unsigned int) data & 3);
217 u8 *buf = NULL;
218 dma_addr_t addr;
219 int ret;
220
221 if (!len)
222 return 0;
223
224 if (WARN_ON(len % SHA_BLOCK_SIZE))
225 return -EINVAL;
226
227 if (inplace) {
228 addr = dma_map_single(dev, (void *) data, len, DMA_TO_DEVICE);
229 if (dma_mapping_error(dev, addr)) {
230 dev_err(dev, "error mapping src\n");
231 return -EIO;
232 }
233
234 inplace = !(addr & 3);
235 if (!inplace)
236 dma_unmap_single(dev, addr, len, DMA_TO_DEVICE);
237 }
238
239 if (!inplace) {
240 buf = dma_alloc_attrs(dev, len, &addr,
241 may_sleep ? GFP_KERNEL : GFP_ATOMIC, 0);
242 if (!buf)
243 return -ENOMEM;
244 memcpy(buf, data, len);
245 }
246
247 dma_sync_single_for_device(dev, addr, len, DMA_TO_DEVICE);
248 ret = hica_sha_record(priv, addr, len) ?:
249 hica_sha_wait(priv, SHA_RECORD_READY);
250
251 if (!buf)
252 dma_unmap_single(dev, addr, len, DMA_TO_DEVICE);
253 else {
254 memzero_explicit(buf, len);
255 dma_free_attrs(dev, len, buf, addr, 0);
256 }
257
258 pr_debug("%s: read %u\n", __func__, len);
259 return ret;
260 }
261

--
0-DAY CI Kernel Test Service