All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH 06/17] fortify: Detect struct member overflows in memcpy() at compile-time
Date: Tue, 14 Dec 2021 11:56:21 +0800	[thread overview]
Message-ID: <202112141126.S8eWMmlc-lkp@intel.com> (raw)
In-Reply-To: <20211213223331.135412-7-keescook@chromium.org>

[-- Attachment #1: Type: text/plain, Size: 11370 bytes --]

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-time-memcpy-fortify-checks/20211214-064002
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-lkp(a)intel.com/config)
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/80c8d2aae95aae6bd09e3ef84b74d0afe631abae
        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@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(a)lists.01.org

  reply	other threads:[~2021-12-14  3:56 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-13 22:33 [PATCH 00/17] Enable strict compile-time memcpy() fortify checks Kees Cook
2021-12-13 22:33 ` [PATCH 01/17] KVM: x86: Replace memset() "optimization" with normal per-field writes Kees Cook
2021-12-13 22:33 ` [PATCH 02/17] net/mlx5e: Avoid field-overflowing memcpy() Kees Cook
2021-12-13 22:33 ` [PATCH 03/17] net/mlx5e: Use struct_group() for memcpy() region Kees Cook
2021-12-13 22:33 ` [PATCH 04/17] media: omap3isp: " Kees Cook
2021-12-13 22:33 ` [PATCH 05/17] sata_fsl: " Kees Cook
2021-12-13 22:33 ` [PATCH 06/17] fortify: Detect struct member overflows in memcpy() at compile-time Kees Cook
2021-12-14  3:56   ` kernel test robot [this message]
2021-12-14  8:46   ` kernel test robot
2021-12-14 11:50   ` kernel test robot
2021-12-14 16:32   ` kernel test robot
2021-12-14 19:06   ` kernel test robot
2021-12-16  8:56   ` kernel test robot
2021-12-16 11:08   ` Mark Rutland
2021-12-16 11:21     ` Mark Rutland
2021-12-16 18:00     ` Kees Cook
2021-12-17 13:34       ` Mark Rutland
2021-12-13 22:33 ` [PATCH 07/17] fortify: Detect struct member overflows in memmove() " Kees Cook
2021-12-13 22:33 ` [PATCH 08/17] ath11k: Use memset_startat() for clearing queue descriptors Kees Cook
2021-12-13 22:33   ` Kees Cook
2021-12-14  6:02   ` Kalle Valo
2021-12-14  6:02     ` Kalle Valo
2021-12-14 15:46     ` Kalle Valo
2021-12-14 15:46       ` Kalle Valo
2021-12-14 17:05       ` Kees Cook
2021-12-14 17:05         ` Kees Cook
2021-12-16 13:50         ` Kalle Valo
2021-12-16 13:50           ` Kalle Valo
2021-12-13 22:33 ` [PATCH 09/17] RDMA/mlx5: Use memset_after() to zero struct mlx5_ib_mr Kees Cook
2021-12-13 22:33 ` [PATCH 10/17] drbd: Use struct_group() to zero algs Kees Cook
2021-12-13 22:33   ` [Drbd-dev] " Kees Cook
2021-12-13 22:33 ` [dm-devel] [PATCH 11/17] dm integrity: Use struct_group() to zero struct journal_sector Kees Cook
2021-12-13 22:33   ` Kees Cook
2021-12-13 22:33 ` [PATCH 12/17] iw_cxgb4: Use memset_startat() for cpl_t5_pass_accept_rpl Kees Cook
2021-12-13 22:33 ` [PATCH 13/17] intel_th: msu: Use memset_startat() for clearing hw header Kees Cook
2021-12-13 22:33 ` [PATCH 14/17] IB/mthca: Use memset_startat() for clearing mpt_entry Kees Cook
2021-12-13 22:33 ` [PATCH 15/17] scsi: lpfc: Use struct_group() to initialize struct lpfc_cgn_info Kees Cook
2021-12-13 22:33 ` [PATCH 16/17] fortify: Detect struct member overflows in memset() at compile-time Kees Cook
2021-12-14 12:31   ` kernel test robot
2021-12-13 22:33 ` [PATCH 17/17] fortify: Work around Clang inlining bugs Kees Cook
2021-12-14 13:22   ` kernel test robot
2021-12-14 13:22     ` kernel test robot
2021-12-15  0:26 ` [PATCH 00/17] Enable strict compile-time memcpy() fortify checks Jason Gunthorpe
2021-12-17  4:04 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202112141126.S8eWMmlc-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.