Skip to contentSkip to conversation

drivers//crypto/zynqmp-sha.c:125:3: error: implicit declaration of function '__flush_cache_user_range'

PATCH New kbuild test robot 2 participants 2 messages Nov 6, 2017

lore
Share & tools
lore

kbuild test robot

author build bot
#0 lore raw

Hi Nava,

FYI, the error/warning still remains.

tree:   https://github.com/Xilinx/linux-xlnx master
head:   1f7f4c5a58cfd0fddfaf2e510bc8f01ed2e7182d
commit: 6aa92efb058fe13225b5ee06e2d6ca5f221e505f [1035/1087] crypto: zynqmp-sha: Adopted SHA3 support for ZynqMP Soc
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 6.2.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
git checkout 6aa92efb058fe13225b5ee06e2d6ca5f221e505f
# save the attached .config to linux build tree
make.cross ARCH=ia64

All errors (new ones prefixed by >>):

drivers//crypto/zynqmp-sha.c: In function 'zynqmp_sha_update':

>> drivers//crypto/zynqmp-sha.c:125:3: error: implicit declaration of function '__flush_cache_user_range' [-Werror=implicit-function-declaration]
      __flush_cache_user_range((unsigned long)kbuf,
      ^~~~~~~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors

vim +/__flush_cache_user_range +125 drivers//crypto/zynqmp-sha.c

107
108 static int zynqmp_sha_update(struct ahash_request *req)
109 {
110 struct zynqmp_sha_ctx *tctx = crypto_tfm_ctx(req->base.tfm);
111 struct zynqmp_sha_dev *dd = tctx->dd;
112 char *kbuf;
113 size_t dma_size = req->nbytes;
114 dma_addr_t dma_addr;
115 int ret;
116
117 if (!req->nbytes)
118 return 0;
119
120 kbuf = dma_alloc_coherent(dd->dev, dma_size, &dma_addr, GFP_KERNEL);
121 if (!kbuf)
122 return -ENOMEM;
123
124 scatterwalk_map_and_copy(kbuf, req->src, 0, req->nbytes, 0);

 > 125		 __flush_cache_user_range((unsigned long)kbuf,

126 (unsigned long)kbuf + dma_size);
127 ret = zynqmp_pm_sha_hash(dma_addr, req->nbytes, ZYNQMP_SHA3_UPDATE);
128 dma_free_coherent(dd->dev, dma_size, kbuf, dma_addr);
129
130 return ret;
131 }
132

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 45300 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171106/7016bb7e/attachment-0001.gz>

#1 lore raw

PATCH 1035/1087 drivers//crypto/zynqmp-sha.c:125:3: error: implicit declaration of function '__flush_cache_user_range'

Quoted 29 lines · kbuild test robot

Hi Nava,

FYI, the error/warning still remains.
drivers//crypto/zynqmp-sha.c: In function 'zynqmp_sha_update':

Quoted 1 line
Quoted 1 line

drivers//crypto/zynqmp-sha.c:125:3: error: implicit declaration of function '__flush_cache_user_range' [-Werror=implicit-function-declaration]

      __flush_cache_user_range((unsigned long)kbuf,
      ^~~~~~~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors

vim +/__flush_cache_user_range +125 drivers//crypto/zynqmp-sha.c

   107	
   108	static int zynqmp_sha_update(struct ahash_request *req)
   109	{
   110		struct zynqmp_sha_ctx *tctx = crypto_tfm_ctx(req->base.tfm);
   111		struct zynqmp_sha_dev *dd = tctx->dd;
   112		char *kbuf;
   113		size_t dma_size = req->nbytes;
   114		dma_addr_t dma_addr;
   115		int ret;
   116	
   117		if (!req->nbytes)
   118			return 0;
   119	
   120		kbuf = dma_alloc_coherent(dd->dev, dma_size, &dma_addr, GFP_KERNEL);
   121		if (!kbuf)
   122			return -ENOMEM;
   123	
   124		scatterwalk_map_and_copy(kbuf, req->src, 0, req->nbytes, 0);
Quoted 2 lines
Quoted 1 line

125 __flush_cache_user_range((unsigned long)kbuf,

126 (unsigned long)kbuf + dma_size);

This is stupid. This is passing a _kernel_ address to a function that expects to flush addresses for _userspace_ addresses.

So, NAK on this code from an architecture point of view, it's wrong.

Also, general point (yet again) that drivers should never go under scratching about in the architecture header files and find architecture private functions. The hint is the double-underscore at the start of the name - and yet again proves that nothing in safe from driver authors if they can get to it via some header file.

Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up