Re: [PATCH] wilc1000: fix DMA on stack objects

From: kernel test robot
Date: Sun Jul 31 2022 - 07:47:36 EST


Hi Michael,

I love your patch! Yet something to improve:

[auto build test ERROR on wireless/main]
[also build test ERROR on linus/master v5.19-rc8 next-20220728]
[cannot apply to wireless-next/main]
[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/Michael-Walle/wilc1000-fix-DMA-on-stack-objects/20220728-232309
base: https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless.git main
config: nios2-allyesconfig (https://download.01.org/0day-ci/archive/20220731/202207311900.lzckeJZU-lkp@xxxxxxxxx/config)
compiler: nios2-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/c04b2e109aebded7849c37f13a3ab7b76b4c0496
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Michael-Walle/wilc1000-fix-DMA-on-stack-objects/20220728-232309
git checkout c04b2e109aebded7849c37f13a3ab7b76b4c0496
# 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=nios2 SHELL=/bin/bash

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

All errors (new ones prefixed by >>):

drivers/net/wireless/microchip/wilc1000/sdio.c: In function 'wilc_sdio_cmd53':
>> drivers/net/wireless/microchip/wilc1000/sdio.c:107:39: error: implicit declaration of function 'object_is_on_stack' [-Werror=implicit-function-declaration]
107 | if ((!virt_addr_valid(buf) || object_is_on_stack(buf)) &&
| ^~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors


vim +/object_is_on_stack +107 drivers/net/wireless/microchip/wilc1000/sdio.c

89
90 static int wilc_sdio_cmd53(struct wilc *wilc, struct sdio_cmd53 *cmd)
91 {
92 struct sdio_func *func = container_of(wilc->dev, struct sdio_func, dev);
93 struct wilc_sdio *sdio_priv = wilc->bus_data;
94 bool need_bounce_buf = false;
95 u8 *buf = cmd->buffer;
96 int size, ret;
97
98 sdio_claim_host(func);
99
100 func->num = cmd->function;
101 func->cur_blksize = cmd->block_size;
102 if (cmd->block_mode)
103 size = cmd->count * cmd->block_size;
104 else
105 size = cmd->count;
106
> 107 if ((!virt_addr_valid(buf) || object_is_on_stack(buf)) &&
108 !WARN_ON_ONCE(size > WILC_SDIO_BLOCK_SIZE)) {
109 need_bounce_buf = true;
110 buf = sdio_priv->dma_buffer;
111 }
112
113 if (cmd->read_write) { /* write */
114 if (need_bounce_buf)
115 memcpy(buf, cmd->buffer, size);
116 ret = sdio_memcpy_toio(func, cmd->address, buf, size);
117 } else { /* read */
118 ret = sdio_memcpy_fromio(func, buf, cmd->address, size);
119 if (need_bounce_buf)
120 memcpy(cmd->buffer, buf, size);
121 }
122
123 sdio_release_host(func);
124
125 if (ret)
126 dev_err(&func->dev, "%s..failed, err(%d)\n", __func__, ret);
127
128 return ret;
129 }
130

--
0-DAY CI Kernel Test Service
https://01.org/lkp