Re: [PATCH V2 3/4] crypto: xilinx: Add ZynqMP RSA driver

From: kernel test robot
Date: Thu Mar 23 2023 - 04:39:12 EST


Hi Harsha,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on herbert-cryptodev-2.6/master]
[cannot apply to xilinx-xlnx/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Harsha-Harsha/firmware-xilinx-Get-the-SoC-family-specific-data-for-crypto-operation/20230321-133614
base: https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
patch link: https://lore.kernel.org/r/20230321053446.4303-4-harsha.harsha%40amd.com
patch subject: [PATCH V2 3/4] crypto: xilinx: Add ZynqMP RSA driver
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20230323/202303231642.YR2kApeH-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
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/cbf02c34cdd2de014bd1b1aa58c7e1478c3c83e5
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Harsha-Harsha/firmware-xilinx-Get-the-SoC-family-specific-data-for-crypto-operation/20230321-133614
git checkout cbf02c34cdd2de014bd1b1aa58c7e1478c3c83e5
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/crypto/xilinx/ drivers/gpu/drm/xlnx/

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

All warnings (new ones prefixed by >>):

In file included from drivers/crypto/xilinx/xilinx-rsa.c:8:
In file included from include/linux/dma-mapping.h:10:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __raw_readb(PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from drivers/crypto/xilinx/xilinx-rsa.c:8:
In file included from include/linux/dma-mapping.h:10:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from drivers/crypto/xilinx/xilinx-rsa.c:8:
In file included from include/linux/dma-mapping.h:10:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
>> drivers/crypto/xilinx/xilinx-rsa.c:300:12: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
else if (rq_ctx->op == XILINX_RSA_DECRYPT)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/crypto/xilinx/xilinx-rsa.c:306:49: note: uninitialized use occurs here
crypto_finalize_akcipher_request(engine, areq, err);
^~~
drivers/crypto/xilinx/xilinx-rsa.c:300:8: note: remove the 'if' if its condition is always true
else if (rq_ctx->op == XILINX_RSA_DECRYPT)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/crypto/xilinx/xilinx-rsa.c:285:24: note: initialize the variable 'err' to silence this warning
int need_fallback, err;
^
= 0
7 warnings generated.


vim +300 drivers/crypto/xilinx/xilinx-rsa.c

272
273 static int handle_rsa_req(struct crypto_engine *engine,
274 void *req)
275 {
276 struct akcipher_request *areq = container_of(req,
277 struct akcipher_request,
278 base);
279 struct crypto_akcipher *akcipher = crypto_akcipher_reqtfm(req);
280 struct akcipher_alg *cipher_alg = crypto_akcipher_alg(akcipher);
281 struct xilinx_rsa_tfm_ctx *tfm_ctx = akcipher_tfm_ctx(akcipher);
282 struct xilinx_rsa_req_ctx *rq_ctx = akcipher_request_ctx(areq);
283 struct akcipher_request *subreq = akcipher_request_ctx(req);
284 struct xilinx_rsa_drv_ctx *drv_ctx;
285 int need_fallback, err;
286
287 drv_ctx = container_of(cipher_alg, struct xilinx_rsa_drv_ctx, alg);
288
289 need_fallback = xilinx_fallback_check(tfm_ctx, areq);
290 if (need_fallback) {
291 akcipher_request_set_tfm(subreq, tfm_ctx->fbk_cipher);
292
293 akcipher_request_set_callback(subreq, areq->base.flags,
294 NULL, NULL);
295 akcipher_request_set_crypt(subreq, areq->src, areq->dst,
296 areq->src_len, areq->dst_len);
297
298 if (rq_ctx->op == XILINX_RSA_ENCRYPT)
299 err = crypto_akcipher_encrypt(subreq);
> 300 else if (rq_ctx->op == XILINX_RSA_DECRYPT)
301 err = crypto_akcipher_decrypt(subreq);
302 } else {
303 err = drv_ctx->xilinx_rsa_xcrypt(areq);
304 }
305
306 crypto_finalize_akcipher_request(engine, areq, err);
307
308 return 0;
309 }
310

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