Hi Kees,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.16-rc5]
[cannot apply to rdma/for-next axboe-block/for-next kvm/queue tip/x86/core
mkp-scsi/for-next jejb-scsi/for-next]
[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/Kees-Cook/Enable-strict-compile-...
base:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
aa50faff4416c869b52dff68a937c84d29e12f4b
config: i386-randconfig-s002-20211213
(
https://download.01.org/0day-ci/archive/20211214/202112141126.S8eWMmlc-lk...)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
#
https://github.com/0day-ci/linux/commit/80c8d2aae95aae6bd09e3ef84b74d0afe...
git remote add linux-review
https://github.com/0day-ci/linux
git fetch --no-tags linux-review
Kees-Cook/Enable-strict-compile-time-memcpy-fortify-checks/20211214-064002
git checkout 80c8d2aae95aae6bd09e3ef84b74d0afe631abae
# save the config file to linux build tree
mkdir build_dir
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir
ARCH=i386 SHELL=/bin/bash drivers/pci/endpoint/functions/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
> drivers/pci/endpoint/functions/pci-epf-test.c:288:17: sparse:
sparse: incorrect type in argument 1 (different address spaces) @@ expected void const
* @@ got void [noderef] __iomem *[assigned] dst_addr @@
drivers/pci/endpoint/functions/pci-epf-test.c:288:17: sparse: expected void const *
drivers/pci/endpoint/functions/pci-epf-test.c:288:17: sparse: got void [noderef]
__iomem *[assigned] dst_addr
drivers/pci/endpoint/functions/pci-epf-test.c:288:17: sparse: sparse: incorrect type in
argument 1 (different address spaces) @@ expected void const * @@ got void
[noderef] __iomem *[assigned] src_addr @@
drivers/pci/endpoint/functions/pci-epf-test.c:288:17: sparse: expected void const
*
drivers/pci/endpoint/functions/pci-epf-test.c:288:17: sparse: got void [noderef]
__iomem *[assigned] src_addr
> drivers/pci/endpoint/functions/pci-epf-test.c:288:17: sparse:
sparse: incorrect type in argument 1 (different address spaces) @@ expected void const
* @@ got void [noderef] __iomem *[assigned] dst_addr @@
drivers/pci/endpoint/functions/pci-epf-test.c:288:17: sparse: expected void const *
drivers/pci/endpoint/functions/pci-epf-test.c:288:17: sparse: got void [noderef]
__iomem *[assigned] dst_addr
drivers/pci/endpoint/functions/pci-epf-test.c:288:17: sparse: sparse: incorrect type in
argument 1 (different address spaces) @@ expected void const * @@ got void
[noderef] __iomem *[assigned] src_addr @@
drivers/pci/endpoint/functions/pci-epf-test.c:288:17: sparse: expected void const
*
drivers/pci/endpoint/functions/pci-epf-test.c:288:17: sparse: got void [noderef]
__iomem *[assigned] src_addr
drivers/pci/endpoint/functions/pci-epf-test.c:288:17: sparse: sparse: incorrect type in
argument 1 (different address spaces) @@ expected void * @@ got void [noderef]
__iomem *[assigned] dst_addr @@
drivers/pci/endpoint/functions/pci-epf-test.c:288:17: sparse: expected void *
drivers/pci/endpoint/functions/pci-epf-test.c:288:17: sparse: got void [noderef]
__iomem *[assigned] dst_addr
drivers/pci/endpoint/functions/pci-epf-test.c:288:17: sparse: sparse: incorrect type in
argument 2 (different address spaces) @@ expected void const * @@ got void
[noderef] __iomem *[assigned] src_addr @@
drivers/pci/endpoint/functions/pci-epf-test.c:288:17: sparse: expected void const
*
drivers/pci/endpoint/functions/pci-epf-test.c:288:17: sparse: got void [noderef]
__iomem *[assigned] src_addr
vim +288 drivers/pci/endpoint/functions/pci-epf-test.c
5893c2e5353bb9a Kishon Vijay Abraham I 2020-03-16 226
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 227 static int
pci_epf_test_copy(struct pci_epf_test *epf_test)
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 228 {
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 229 int ret;
5ebf3fc59bd20d1 Kishon Vijay Abraham I 2020-03-16 230 bool use_dma;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 231 void __iomem *src_addr;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 232 void __iomem *dst_addr;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 233 phys_addr_t src_phys_addr;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 234 phys_addr_t dst_phys_addr;
5893c2e5353bb9a Kishon Vijay Abraham I 2020-03-16 235 struct timespec64 start, end;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 236 struct pci_epf *epf =
epf_test->epf;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 237 struct device *dev =
&epf->dev;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 238 struct pci_epc *epc =
epf->epc;
3235b994950d84d Kishon Vijay Abraham I 2017-08-18 239 enum pci_barno test_reg_bar =
epf_test->test_reg_bar;
3235b994950d84d Kishon Vijay Abraham I 2017-08-18 240 struct pci_epf_test_reg *reg =
epf_test->reg[test_reg_bar];
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 241
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 242 src_addr =
pci_epc_mem_alloc_addr(epc, &src_phys_addr, reg->size);
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 243 if (!src_addr) {
798c0441bec8c46 Gustavo Pimentel 2018-05-14 244 dev_err(dev, "Failed to
allocate source address\n");
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 245 reg->status =
STATUS_SRC_ADDR_INVALID;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 246 ret = -ENOMEM;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 247 goto err;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 248 }
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 249
53fd3cbe5e9d791 Kishon Vijay Abraham I 2021-08-19 250 ret = pci_epc_map_addr(epc,
epf->func_no, epf->vfunc_no, src_phys_addr,
53fd3cbe5e9d791 Kishon Vijay Abraham I 2021-08-19 251 reg->src_addr,
reg->size);
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 252 if (ret) {
798c0441bec8c46 Gustavo Pimentel 2018-05-14 253 dev_err(dev, "Failed to map
source address\n");
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 254 reg->status =
STATUS_SRC_ADDR_INVALID;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 255 goto err_src_addr;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 256 }
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 257
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 258 dst_addr =
pci_epc_mem_alloc_addr(epc, &dst_phys_addr, reg->size);
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 259 if (!dst_addr) {
798c0441bec8c46 Gustavo Pimentel 2018-05-14 260 dev_err(dev, "Failed to
allocate destination address\n");
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 261 reg->status =
STATUS_DST_ADDR_INVALID;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 262 ret = -ENOMEM;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 263 goto err_src_map_addr;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 264 }
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 265
53fd3cbe5e9d791 Kishon Vijay Abraham I 2021-08-19 266 ret = pci_epc_map_addr(epc,
epf->func_no, epf->vfunc_no, dst_phys_addr,
53fd3cbe5e9d791 Kishon Vijay Abraham I 2021-08-19 267 reg->dst_addr,
reg->size);
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 268 if (ret) {
798c0441bec8c46 Gustavo Pimentel 2018-05-14 269 dev_err(dev, "Failed to map
destination address\n");
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 270 reg->status =
STATUS_DST_ADDR_INVALID;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 271 goto err_dst_addr;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 272 }
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 273
5893c2e5353bb9a Kishon Vijay Abraham I 2020-03-16 274 ktime_get_ts64(&start);
5ebf3fc59bd20d1 Kishon Vijay Abraham I 2020-03-16 275 use_dma = !!(reg->flags &
FLAG_USE_DMA);
5ebf3fc59bd20d1 Kishon Vijay Abraham I 2020-03-16 276 if (use_dma) {
5ebf3fc59bd20d1 Kishon Vijay Abraham I 2020-03-16 277 if (!epf_test->dma_supported)
{
5ebf3fc59bd20d1 Kishon Vijay Abraham I 2020-03-16 278 dev_err(dev, "Cannot
transfer data using DMA\n");
5ebf3fc59bd20d1 Kishon Vijay Abraham I 2020-03-16 279 ret = -EINVAL;
5ebf3fc59bd20d1 Kishon Vijay Abraham I 2020-03-16 280 goto err_map_addr;
5ebf3fc59bd20d1 Kishon Vijay Abraham I 2020-03-16 281 }
5ebf3fc59bd20d1 Kishon Vijay Abraham I 2020-03-16 282
5ebf3fc59bd20d1 Kishon Vijay Abraham I 2020-03-16 283 ret =
pci_epf_test_data_transfer(epf_test, dst_phys_addr,
5ebf3fc59bd20d1 Kishon Vijay Abraham I 2020-03-16 284 src_phys_addr,
reg->size);
5ebf3fc59bd20d1 Kishon Vijay Abraham I 2020-03-16 285 if (ret)
5ebf3fc59bd20d1 Kishon Vijay Abraham I 2020-03-16 286 dev_err(dev, "Data
transfer failed\n");
5ebf3fc59bd20d1 Kishon Vijay Abraham I 2020-03-16 287 } else {
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 @288 memcpy(dst_addr, src_addr,
reg->size);
5ebf3fc59bd20d1 Kishon Vijay Abraham I 2020-03-16 289 }
5893c2e5353bb9a Kishon Vijay Abraham I 2020-03-16 290 ktime_get_ts64(&end);
5893c2e5353bb9a Kishon Vijay Abraham I 2020-03-16 291
pci_epf_test_print_rate("COPY", reg->size, &start, &end, use_dma);
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 292
5ebf3fc59bd20d1 Kishon Vijay Abraham I 2020-03-16 293 err_map_addr:
53fd3cbe5e9d791 Kishon Vijay Abraham I 2021-08-19 294 pci_epc_unmap_addr(epc,
epf->func_no, epf->vfunc_no, dst_phys_addr);
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 295
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 296 err_dst_addr:
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 297 pci_epc_mem_free_addr(epc,
dst_phys_addr, dst_addr, reg->size);
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 298
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 299 err_src_map_addr:
53fd3cbe5e9d791 Kishon Vijay Abraham I 2021-08-19 300 pci_epc_unmap_addr(epc,
epf->func_no, epf->vfunc_no, src_phys_addr);
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 301
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 302 err_src_addr:
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 303 pci_epc_mem_free_addr(epc,
src_phys_addr, src_addr, reg->size);
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 304
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 305 err:
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 306 return ret;
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 307 }
349e7a85b25fa6e Kishon Vijay Abraham I 2017-03-27 308
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org