Re: [v4] misc: pci_endpoint_test: Fix overflow of bar_size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Hans,

kernel test robot noticed the following build errors:

[auto build test ERROR on pci/next]
[also build test ERROR on pci/for-linus mani-mhi/mhi-next soc/for-next linus/master v6.13-rc5 next-20241220]
[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/Hans-Zhang/misc-pci_endpoint_test-Fix-overflow-of-bar_size/20241231-145733
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next
patch link:    https://lore.kernel.org/r/20241231065500.168799-1-18255117159%40163.com
patch subject: [v4] misc: pci_endpoint_test: Fix overflow of bar_size
config: i386-randconfig-003-20250101 (https://download.01.org/0day-ci/archive/20250101/202501011917.ugP1ywJV-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250101/202501011917.ugP1ywJV-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501011917.ugP1ywJV-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

   ld: drivers/misc/pci_endpoint_test.o: in function `pci_endpoint_test_bar':
>> drivers/misc/pci_endpoint_test.c:315: undefined reference to `__udivmoddi4'


vim +315 drivers/misc/pci_endpoint_test.c

2a35703a6a00e8 Niklas Cassel          2024-03-22  282  
2c156ac71c6b25 Kishon Vijay Abraham I 2017-03-27  283  static bool pci_endpoint_test_bar(struct pci_endpoint_test *test,
2c156ac71c6b25 Kishon Vijay Abraham I 2017-03-27  284  				  enum pci_barno barno)
2c156ac71c6b25 Kishon Vijay Abraham I 2017-03-27  285  {
2a35703a6a00e8 Niklas Cassel          2024-03-22  286  	void *write_buf __free(kfree) = NULL;
2a35703a6a00e8 Niklas Cassel          2024-03-22  287  	void *read_buf __free(kfree) = NULL;
cda370ec6d1f7b Kishon Vijay Abraham I 2017-08-18  288  	struct pci_dev *pdev = test->pdev;
bb17ee74a3494e Hans Zhang             2024-12-31  289  	int j, buf_size, iters, remain;
bb17ee74a3494e Hans Zhang             2024-12-31  290  	resource_size_t bar_size;
2c156ac71c6b25 Kishon Vijay Abraham I 2017-03-27  291  
2c156ac71c6b25 Kishon Vijay Abraham I 2017-03-27  292  	if (!test->bar[barno])
2c156ac71c6b25 Kishon Vijay Abraham I 2017-03-27  293  		return false;
2c156ac71c6b25 Kishon Vijay Abraham I 2017-03-27  294  
2a35703a6a00e8 Niklas Cassel          2024-03-22  295  	bar_size = pci_resource_len(pdev, barno);
2c156ac71c6b25 Kishon Vijay Abraham I 2017-03-27  296  
834b9051992580 Kishon Vijay Abraham I 2017-08-18  297  	if (barno == test->test_reg_bar)
2a35703a6a00e8 Niklas Cassel          2024-03-22  298  		bar_size = 0x4;
834b9051992580 Kishon Vijay Abraham I 2017-08-18  299  
2a35703a6a00e8 Niklas Cassel          2024-03-22  300  	/*
2a35703a6a00e8 Niklas Cassel          2024-03-22  301  	 * Allocate a buffer of max size 1MB, and reuse that buffer while
2a35703a6a00e8 Niklas Cassel          2024-03-22  302  	 * iterating over the whole BAR size (which might be much larger).
2a35703a6a00e8 Niklas Cassel          2024-03-22  303  	 */
2a35703a6a00e8 Niklas Cassel          2024-03-22  304  	buf_size = min(SZ_1M, bar_size);
2c156ac71c6b25 Kishon Vijay Abraham I 2017-03-27  305  
2a35703a6a00e8 Niklas Cassel          2024-03-22  306  	write_buf = kmalloc(buf_size, GFP_KERNEL);
2a35703a6a00e8 Niklas Cassel          2024-03-22  307  	if (!write_buf)
2a35703a6a00e8 Niklas Cassel          2024-03-22  308  		return false;
2a35703a6a00e8 Niklas Cassel          2024-03-22  309  
2a35703a6a00e8 Niklas Cassel          2024-03-22  310  	read_buf = kmalloc(buf_size, GFP_KERNEL);
2a35703a6a00e8 Niklas Cassel          2024-03-22  311  	if (!read_buf)
2a35703a6a00e8 Niklas Cassel          2024-03-22  312  		return false;
2a35703a6a00e8 Niklas Cassel          2024-03-22  313  
2a35703a6a00e8 Niklas Cassel          2024-03-22  314  	iters = bar_size / buf_size;
2a35703a6a00e8 Niklas Cassel          2024-03-22 @315  	for (j = 0; j < iters; j++)
2a35703a6a00e8 Niklas Cassel          2024-03-22  316  		if (pci_endpoint_test_bar_memcmp(test, barno, buf_size * j,
2a35703a6a00e8 Niklas Cassel          2024-03-22  317  						 write_buf, read_buf, buf_size))
2a35703a6a00e8 Niklas Cassel          2024-03-22  318  			return false;
2a35703a6a00e8 Niklas Cassel          2024-03-22  319  
2a35703a6a00e8 Niklas Cassel          2024-03-22  320  	remain = bar_size % buf_size;
2a35703a6a00e8 Niklas Cassel          2024-03-22  321  	if (remain)
2a35703a6a00e8 Niklas Cassel          2024-03-22  322  		if (pci_endpoint_test_bar_memcmp(test, barno, buf_size * iters,
2a35703a6a00e8 Niklas Cassel          2024-03-22  323  						 write_buf, read_buf, remain))
2c156ac71c6b25 Kishon Vijay Abraham I 2017-03-27  324  			return false;
2c156ac71c6b25 Kishon Vijay Abraham I 2017-03-27  325  
2c156ac71c6b25 Kishon Vijay Abraham I 2017-03-27  326  	return true;
2c156ac71c6b25 Kishon Vijay Abraham I 2017-03-27  327  }
2c156ac71c6b25 Kishon Vijay Abraham I 2017-03-27  328  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux