Thread (8 messages) 8 messages, 3 authors, 2021-10-29

Re: [PATCH v3 2/2] crypto: mtk-eip93 - Add Mediatek EIP-93 crypto engine

From: Richard van Schagen <hidden>
Date: 2021-10-29 06:42:13

Hi All,

Before I send another version of this patch I have one question:

I am seeing /warnings from arch/riscv/include/asm/io.h

In my Kconfig I have: depends on SOC_MT7621 || COMPILE_TEST 

I need to keep the include/linux/dma-mapping.h so should I remove 
the COMPILE_TEST or can I safely ignore those warnings?

Thanks,
Richard van Schagen

On 28 Oct 2021, at 14:27, kernel test robot [off-list ref] wrote:

Hi Richard,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on herbert-cryptodev-2.6/master]
[also build test WARNING on herbert-crypto-2.6/master robh/for-next v5.15-rc7 next-20211027]
[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]

url:    https://github.com/0day-ci/linux/commits/Richard-van-Schagen/Enable-the-Mediatek-EIP-93-crypto-engine/20211027-171429
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
config: riscv-randconfig-r031-20211027 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
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
       # install riscv cross compiling tool for clang build
       # apt-get install binutils-riscv64-linux-gnu
       # https://github.com/0day-ci/linux/commit/b4ea2578718d77c7cbac42427a511182d91ac5f1
       git remote add linux-review https://github.com/0day-ci/linux
       git fetch --no-tags linux-review Richard-van-Schagen/Enable-the-Mediatek-EIP-93-crypto-engine/20211027-171429
       git checkout b4ea2578718d77c7cbac42427a511182d91ac5f1
       # save the attached .config to linux build tree
       COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv 

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

All warnings (new ones prefixed by >>):

  In file included from drivers/crypto/mtk-eip93/eip93-common.c:15:
  In file included from include/linux/dma-mapping.h:10:
  In file included from include/linux/scatterlist.h:9:
  In file included from arch/riscv/include/asm/io.h:136:
  include/asm-generic/io.h:464: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:477: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:36:51: note: expanded from macro '__le16_to_cpu'
  #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
                                                    ^
  In file included from drivers/crypto/mtk-eip93/eip93-common.c:15:
  In file included from include/linux/dma-mapping.h:10:
  In file included from include/linux/scatterlist.h:9:
  In file included from arch/riscv/include/asm/io.h:136:
  include/asm-generic/io.h:490: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:34:51: note: expanded from macro '__le32_to_cpu'
  #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
                                                    ^
  In file included from drivers/crypto/mtk-eip93/eip93-common.c:15:
  In file included from include/linux/dma-mapping.h:10:
  In file included from include/linux/scatterlist.h:9:
  In file included from arch/riscv/include/asm/io.h:136:
  include/asm-generic/io.h:501: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:511: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:521: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);
                                                        ~~~~~~~~~~ ^
  include/asm-generic/io.h:1024:55: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
          return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
                                                    ~~~~~~~~~~ ^
  drivers/crypto/mtk-eip93/eip93-common.c:282:6: warning: no previous prototype for function 'mtk_set_saRecord' [-Wmissing-prototypes]
  void mtk_set_saRecord(struct saRecord_s *saRecord, const unsigned int keylen,
       ^
  drivers/crypto/mtk-eip93/eip93-common.c:282:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
  void mtk_set_saRecord(struct saRecord_s *saRecord, const unsigned int keylen,
  ^
  static 
  drivers/crypto/mtk-eip93/eip93-common.c:527:18: warning: cast to smaller integer type 'u32' (aka 'unsigned int') from 'const u8 *' (aka 'const unsigned char *') [-Wpointer-to-int-cast]
          if (!IS_ALIGNED((u32)reqiv, rctx->ivsize) || IS_RFC3686(flags)) {
                          ^~~~~~~~~~
  include/linux/align.h:13:30: note: expanded from macro 'IS_ALIGNED'
  #define IS_ALIGNED(x, a)                (((x) & ((typeof(x))(a) - 1)) == 0)
                                             ^
  drivers/crypto/mtk-eip93/eip93-common.c:527:18: warning: cast to smaller integer type 'u32' (aka 'unsigned int') from 'const u8 *' (aka 'const unsigned char *') [-Wpointer-to-int-cast]
          if (!IS_ALIGNED((u32)reqiv, rctx->ivsize) || IS_RFC3686(flags)) {
                          ^~~~~~~~~~
  include/linux/align.h:13:44: note: expanded from macro 'IS_ALIGNED'
  #define IS_ALIGNED(x, a)                (((x) & ((typeof(x))(a) - 1)) == 0)
                                                           ^
  drivers/crypto/mtk-eip93/eip93-common.c:593:19: warning: cast to smaller integer type 'u32' (aka 'unsigned int') from 'struct crypto_async_request *' [-Wpointer-to-int-cast]
          cdesc.arc4Addr = (u32)async;
                           ^~~~~~~~~~
  drivers/crypto/mtk-eip93/eip93-common.c:693:5: warning: no previous prototype for function 'mtk_skcipher_send_req' [-Wmissing-prototypes]
  int mtk_skcipher_send_req(struct crypto_async_request *async)
      ^
  drivers/crypto/mtk-eip93/eip93-common.c:693:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
  int mtk_skcipher_send_req(struct crypto_async_request *async)
  ^
  static 
  drivers/crypto/mtk-eip93/eip93-common.c:709:6: warning: no previous prototype for function 'mtk_skcipher_handle_result' [-Wmissing-prototypes]
  void mtk_skcipher_handle_result(struct mtk_device *mtk,
       ^
  drivers/crypto/mtk-eip93/eip93-common.c:709:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
  void mtk_skcipher_handle_result(struct mtk_device *mtk,
  ^
  static 
quoted
quoted
drivers/crypto/mtk-eip93/eip93-common.c:725:5: warning: no previous prototype for function 'mtk_authenc_setkey' [-Wmissing-prototypes]
  int mtk_authenc_setkey(struct crypto_shash *cshash, struct saRecord_s *sa,
      ^
  drivers/crypto/mtk-eip93/eip93-common.c:725:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
  int mtk_authenc_setkey(struct crypto_shash *cshash, struct saRecord_s *sa,
  ^
  static 
  14 warnings generated.
--
  In file included from drivers/crypto/mtk-eip93/eip93-aead.c:24:
  In file included from include/linux/dma-mapping.h:10:
  In file included from include/linux/scatterlist.h:9:
  In file included from arch/riscv/include/asm/io.h:136:
  include/asm-generic/io.h:464: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:477: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:36:51: note: expanded from macro '__le16_to_cpu'
  #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
                                                    ^
  In file included from drivers/crypto/mtk-eip93/eip93-aead.c:24:
  In file included from include/linux/dma-mapping.h:10:
  In file included from include/linux/scatterlist.h:9:
  In file included from arch/riscv/include/asm/io.h:136:
  include/asm-generic/io.h:490: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:34:51: note: expanded from macro '__le32_to_cpu'
  #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
                                                    ^
  In file included from drivers/crypto/mtk-eip93/eip93-aead.c:24:
  In file included from include/linux/dma-mapping.h:10:
  In file included from include/linux/scatterlist.h:9:
  In file included from arch/riscv/include/asm/io.h:136:
  include/asm-generic/io.h:501: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:511: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:521: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);
                                                        ~~~~~~~~~~ ^
  include/asm-generic/io.h:1024:55: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
          return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
                                                    ~~~~~~~~~~ ^
quoted
quoted
drivers/crypto/mtk-eip93/eip93-aead.c:30:6: warning: no previous prototype for function 'mtk_aead_handle_result' [-Wmissing-prototypes]
  void mtk_aead_handle_result(struct mtk_device *mtk,
       ^
  drivers/crypto/mtk-eip93/eip93-aead.c:30:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
  void mtk_aead_handle_result(struct mtk_device *mtk,
  ^
  static 
quoted
quoted
drivers/crypto/mtk-eip93/eip93-aead.c:49:5: warning: no previous prototype for function 'mtk_aead_send_req' [-Wmissing-prototypes]
  int mtk_aead_send_req(struct crypto_async_request *async)
      ^
  drivers/crypto/mtk-eip93/eip93-aead.c:49:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
  int mtk_aead_send_req(struct crypto_async_request *async)
  ^
  static 
quoted
quoted
drivers/crypto/mtk-eip93/eip93-aead.c:152:7: warning: variable 'err' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
                  if (keys.enckeylen < CTR_RFC3686_NONCE_SIZE)
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  drivers/crypto/mtk-eip93/eip93-aead.c:209:9: note: uninitialized use occurs here
          return err;
                 ^~~
  drivers/crypto/mtk-eip93/eip93-aead.c:152:3: note: remove the 'if' if its condition is always false
                  if (keys.enckeylen < CTR_RFC3686_NONCE_SIZE)
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  drivers/crypto/mtk-eip93/eip93-aead.c:145:9: note: initialize the variable 'err' to silence this warning
          int err;
                 ^
                  = 0
  10 warnings generated.


vim +/mtk_authenc_setkey +725 drivers/crypto/mtk-eip93/eip93-common.c

  708	
quoted
709	void mtk_skcipher_handle_result(struct mtk_device *mtk,
  710					struct crypto_async_request *async,
  711					int err)
  712	{
  713		struct skcipher_request *req = skcipher_request_cast(async);
  714		struct mtk_cipher_reqctx *rctx = skcipher_request_ctx(req);
  715	
  716		mtk_unmap_dma(mtk, rctx, req->src, req->dst);
  717		mtk_handle_result(mtk, rctx, req->iv);
  718	
  719		skcipher_request_complete(req, err);
  720	}
  721	#endif
  722	
  723	#if IS_ENABLED(CONFIG_CRYPTO_DEV_EIP93_HMAC)
  724	/* basically this is set hmac - key */
quoted
725	int mtk_authenc_setkey(struct crypto_shash *cshash, struct saRecord_s *sa,
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
<.config.gz>
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help