All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH next v4 2/5] minmax: Allow min()/max()/clamp() if the arguments have the same signedness.
@ 2023-09-19  2:28 kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2023-09-19  2:28 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "low confidence static check first_new_problem: arch/x86/xen/setup.c:809:23: sparse: sparse: too long token expansion"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <fe7e6c542e094bfca655abcd323c1c98@AcuMS.aculab.com>
References: <fe7e6c542e094bfca655abcd323c1c98@AcuMS.aculab.com>
TO: David Laight <David.Laight@ACULAB.COM>
TO: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
CC: "'Andy Shevchenko'" <andriy.shevchenko@linux.intel.com>
CC: "'Andrew Morton'" <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>
CC: "'Matthew Wilcox (Oracle)'" <willy@infradead.org>
CC: "'Christoph Hellwig'" <hch@infradead.org>
CC: "'Jason A. Donenfeld'" <Jason@zx2c4.com>

Hi David,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linux/master]
[also build test WARNING on linus/master v6.6-rc2]
[cannot apply to next-20230918 next-20230918]
[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/David-Laight/minmax-Add-umin-a-b-and-umax-a-b/20230918-162441
base:   linux/master
patch link:    https://lore.kernel.org/r/fe7e6c542e094bfca655abcd323c1c98%40AcuMS.aculab.com
patch subject: [PATCH next v4 2/5] minmax: Allow min()/max()/clamp() if the arguments have the same signedness.
:::::: branch date: 18 hours ago
:::::: commit date: 18 hours ago
config: x86_64-randconfig-121-20230919 (https://download.01.org/0day-ci/archive/20230919/202309191015.AQJPCIDL-lkp@intel.com/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/20230919/202309191015.AQJPCIDL-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/r/202309191015.AQJPCIDL-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> arch/x86/xen/setup.c:809:23: sparse: sparse: too long token expansion
>> arch/x86/xen/setup.c:809:23: sparse: sparse: too long token expansion
>> arch/x86/xen/setup.c:809:23: sparse: sparse: too long token expansion
>> arch/x86/xen/setup.c:809:23: sparse: sparse: too long token expansion

vim +809 arch/x86/xen/setup.c

1d988ed46543ca arch/x86/xen/setup.c  Juergen Gross         2019-02-14  752  
9e9a5fcb04e3af arch/x86/xen/setup.c  Ian Campbell          2010-09-02  753  	op = xen_initial_domain() ?
9e9a5fcb04e3af arch/x86/xen/setup.c  Ian Campbell          2010-09-02  754  		XENMEM_machine_memory_map :
9e9a5fcb04e3af arch/x86/xen/setup.c  Ian Campbell          2010-09-02  755  		XENMEM_memory_map;
9e9a5fcb04e3af arch/x86/xen/setup.c  Ian Campbell          2010-09-02  756  	rc = HYPERVISOR_memory_op(op, &memmap);
35ae11fd146384 arch/x86/xen/setup.c  Ian Campbell          2009-02-06  757  	if (rc == -ENOSYS) {
9ec23a7f6d2537 arch/x86/xen/setup.c  Ian Campbell          2010-10-28  758  		BUG_ON(xen_initial_domain());
35ae11fd146384 arch/x86/xen/setup.c  Ian Campbell          2009-02-06  759  		memmap.nr_entries = 1;
e7dbf7ad4172ef arch/x86/xen/setup.c  Ingo Molnar           2017-01-28  760  		xen_e820_table.entries[0].addr = 0ULL;
e7dbf7ad4172ef arch/x86/xen/setup.c  Ingo Molnar           2017-01-28  761  		xen_e820_table.entries[0].size = mem_end;
35ae11fd146384 arch/x86/xen/setup.c  Ian Campbell          2009-02-06  762  		/* 8MB slack (to balance backend allocations). */
e7dbf7ad4172ef arch/x86/xen/setup.c  Ingo Molnar           2017-01-28  763  		xen_e820_table.entries[0].size += 8ULL << 20;
e7dbf7ad4172ef arch/x86/xen/setup.c  Ingo Molnar           2017-01-28  764  		xen_e820_table.entries[0].type = E820_TYPE_RAM;
35ae11fd146384 arch/x86/xen/setup.c  Ian Campbell          2009-02-06  765  		rc = 0;
35ae11fd146384 arch/x86/xen/setup.c  Ian Campbell          2009-02-06  766  	}
35ae11fd146384 arch/x86/xen/setup.c  Ian Campbell          2009-02-06  767  	BUG_ON(rc);
1ea644c8f93f34 arch/x86/xen/setup.c  Martin Kelly          2014-10-16  768  	BUG_ON(memmap.nr_entries == 0);
e7dbf7ad4172ef arch/x86/xen/setup.c  Ingo Molnar           2017-01-28  769  	xen_e820_table.nr_entries = memmap.nr_entries;
8006ec3e911f93 arch/x86/xen/setup.c  Jeremy Fitzhardinge   2008-05-26  770  
9338c2233b97f9 arch/x86/xen/setup.c  Ross Lagerwall        2023-06-05  771  	if (xen_initial_domain()) {
3bc38cbceb8588 arch/x86/xen/setup.c  David Vrabel          2013-08-16  772  		/*
3bc38cbceb8588 arch/x86/xen/setup.c  David Vrabel          2013-08-16  773  		 * Xen won't allow a 1:1 mapping to be created to UNUSABLE
3bc38cbceb8588 arch/x86/xen/setup.c  David Vrabel          2013-08-16  774  		 * regions, so if we're using the machine memory map leave the
3bc38cbceb8588 arch/x86/xen/setup.c  David Vrabel          2013-08-16  775  		 * region as RAM as it is in the pseudo-physical map.
3bc38cbceb8588 arch/x86/xen/setup.c  David Vrabel          2013-08-16  776  		 *
3bc38cbceb8588 arch/x86/xen/setup.c  David Vrabel          2013-08-16  777  		 * UNUSABLE regions in domUs are not handled and will need
3bc38cbceb8588 arch/x86/xen/setup.c  David Vrabel          2013-08-16  778  		 * a patch in the future.
3bc38cbceb8588 arch/x86/xen/setup.c  David Vrabel          2013-08-16  779  		 */
69632ecfcd03b1 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  780  		xen_ignore_unusable();
3bc38cbceb8588 arch/x86/xen/setup.c  David Vrabel          2013-08-16  781  
9338c2233b97f9 arch/x86/xen/setup.c  Ross Lagerwall        2023-06-05  782  #ifdef CONFIG_ISCSI_IBFT_FIND
9338c2233b97f9 arch/x86/xen/setup.c  Ross Lagerwall        2023-06-05  783  		/* Reserve 0.5 MiB to 1 MiB region so iBFT can be found */
9338c2233b97f9 arch/x86/xen/setup.c  Ross Lagerwall        2023-06-05  784  		xen_e820_table.entries[xen_e820_table.nr_entries].addr = IBFT_START;
9338c2233b97f9 arch/x86/xen/setup.c  Ross Lagerwall        2023-06-05  785  		xen_e820_table.entries[xen_e820_table.nr_entries].size = IBFT_END - IBFT_START;
9338c2233b97f9 arch/x86/xen/setup.c  Ross Lagerwall        2023-06-05  786  		xen_e820_table.entries[xen_e820_table.nr_entries].type = E820_TYPE_RESERVED;
9338c2233b97f9 arch/x86/xen/setup.c  Ross Lagerwall        2023-06-05  787  		xen_e820_table.nr_entries++;
9338c2233b97f9 arch/x86/xen/setup.c  Ross Lagerwall        2023-06-05  788  #endif
9338c2233b97f9 arch/x86/xen/setup.c  Ross Lagerwall        2023-06-05  789  	}
9338c2233b97f9 arch/x86/xen/setup.c  Ross Lagerwall        2023-06-05  790  
dc91c728fddc29 arch/x86/xen/setup.c  David Vrabel          2011-09-29  791  	/* Make sure the Xen-supplied memory map is well-ordered. */
f9748fa0458510 arch/x86/xen/setup.c  Ingo Molnar           2017-01-28  792  	e820__update_table(&xen_e820_table);
b5b43ced7a6e79 arch/x86/xen/setup.c  Jeremy Fitzhardinge   2010-09-02  793  
dc91c728fddc29 arch/x86/xen/setup.c  David Vrabel          2011-09-29  794  	max_pages = xen_get_max_pages();
7cb31b752c71e0 arch/x86/xen/setup.c  Stefano Stabellini    2011-01-27  795  
5097cdf6cef154 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  796  	/* How many extra pages do we need due to remapping? */
dd14be92fbf5bc arch/x86/xen/setup.c  Juergen Gross         2016-05-18  797  	max_pages += xen_foreach_remap_area(max_pfn, xen_count_remap_pages);
eafd72e016c69d arch/x86/xen/setup.c  Juergen Gross         2015-08-19  798  
eafd72e016c69d arch/x86/xen/setup.c  Juergen Gross         2015-08-19  799  	if (max_pages > max_pfn)
eafd72e016c69d arch/x86/xen/setup.c  Juergen Gross         2015-08-19  800  		extra_pages += max_pages - max_pfn;
2e2fb75475c2fc arch/x86/xen/setup.c  Konrad Rzeszutek Wilk 2012-04-06  801  
2f14ddc3a7146e arch/x86/xen/setup.c  Zhang, Fengzhe        2011-02-16  802  	/*
af44a387e743ab arch/x86/xen/setup.c  Roger Pau Monne       2021-03-24  803  	 * Clamp the amount of extra memory to a EXTRA_MEM_RATIO
882213990d32fd arch/x86/xen/setup.c  Juergen Gross         2021-02-24  804  	 * factor the base size.
dc91c728fddc29 arch/x86/xen/setup.c  David Vrabel          2011-09-29  805  	 *
c70727a5bc18a5 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  806  	 * Make sure we have no memory above max_pages, as this area
c70727a5bc18a5 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  807  	 * isn't handled by the p2m management.
2f14ddc3a7146e arch/x86/xen/setup.c  Zhang, Fengzhe        2011-02-16  808  	 */
af44a387e743ab arch/x86/xen/setup.c  Roger Pau Monne       2021-03-24 @809  	extra_pages = min3(EXTRA_MEM_RATIO * min(max_pfn, PFN_DOWN(MAXMEM)),
c70727a5bc18a5 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  810  			   extra_pages, max_pages - max_pfn);
dc91c728fddc29 arch/x86/xen/setup.c  David Vrabel          2011-09-29  811  	i = 0;
e7dbf7ad4172ef arch/x86/xen/setup.c  Ingo Molnar           2017-01-28  812  	addr = xen_e820_table.entries[0].addr;
e7dbf7ad4172ef arch/x86/xen/setup.c  Ingo Molnar           2017-01-28  813  	size = xen_e820_table.entries[0].size;
e7dbf7ad4172ef arch/x86/xen/setup.c  Ingo Molnar           2017-01-28  814  	while (i < xen_e820_table.nr_entries) {
123664101aa215 arch/x86/xen/setup.c  Igor Druzhinin        2018-11-27  815  		bool discard = false;
f5775e0b6116b7 arch/x86/xen/setup.c  David Vrabel          2015-01-19  816  
5097cdf6cef154 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  817  		chunk_size = size;
e7dbf7ad4172ef arch/x86/xen/setup.c  Ingo Molnar           2017-01-28  818  		type = xen_e820_table.entries[i].type;
dc91c728fddc29 arch/x86/xen/setup.c  David Vrabel          2011-09-29  819  
358cd9afd06999 arch/x86/xen/setup.c  Juergen Gross         2023-06-12  820  		if (type == E820_TYPE_RESERVED)
358cd9afd06999 arch/x86/xen/setup.c  Juergen Gross         2023-06-12  821  			xen_pv_pci_possible = true;
358cd9afd06999 arch/x86/xen/setup.c  Juergen Gross         2023-06-12  822  
09821ff1d50a1e arch/x86/xen/setup.c  Ingo Molnar           2017-01-28  823  		if (type == E820_TYPE_RAM) {
dc91c728fddc29 arch/x86/xen/setup.c  David Vrabel          2011-09-29  824  			if (addr < mem_end) {
5097cdf6cef154 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  825  				chunk_size = min(size, mem_end - addr);
dc91c728fddc29 arch/x86/xen/setup.c  David Vrabel          2011-09-29  826  			} else if (extra_pages) {
5097cdf6cef154 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  827  				chunk_size = min(size, PFN_PHYS(extra_pages));
626d7508664c4b arch/x86/xen/setup.c  Juergen Gross         2015-09-04  828  				pfn_s = PFN_UP(addr);
626d7508664c4b arch/x86/xen/setup.c  Juergen Gross         2015-09-04  829  				n_pfns = PFN_DOWN(addr + chunk_size) - pfn_s;
626d7508664c4b arch/x86/xen/setup.c  Juergen Gross         2015-09-04  830  				extra_pages -= n_pfns;
626d7508664c4b arch/x86/xen/setup.c  Juergen Gross         2015-09-04  831  				xen_add_extra_mem(pfn_s, n_pfns);
626d7508664c4b arch/x86/xen/setup.c  Juergen Gross         2015-09-04  832  				xen_max_p2m_pfn = pfn_s + n_pfns;
dc91c728fddc29 arch/x86/xen/setup.c  David Vrabel          2011-09-29  833  			} else
123664101aa215 arch/x86/xen/setup.c  Igor Druzhinin        2018-11-27  834  				discard = true;
35ae11fd146384 arch/x86/xen/setup.c  Ian Campbell          2009-02-06  835  		}
be5bf9fa1c327f arch/x86/xen/setup.c  Jeremy Fitzhardinge   2008-06-16  836  
123664101aa215 arch/x86/xen/setup.c  Igor Druzhinin        2018-11-27  837  		if (!discard)
5097cdf6cef154 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  838  			xen_align_and_add_e820_region(addr, chunk_size, type);
b5b43ced7a6e79 arch/x86/xen/setup.c  Jeremy Fitzhardinge   2010-09-02  839  
5097cdf6cef154 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  840  		addr += chunk_size;
5097cdf6cef154 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  841  		size -= chunk_size;
5097cdf6cef154 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  842  		if (size == 0) {
dc91c728fddc29 arch/x86/xen/setup.c  David Vrabel          2011-09-29  843  			i++;
e7dbf7ad4172ef arch/x86/xen/setup.c  Ingo Molnar           2017-01-28  844  			if (i < xen_e820_table.nr_entries) {
e7dbf7ad4172ef arch/x86/xen/setup.c  Ingo Molnar           2017-01-28  845  				addr = xen_e820_table.entries[i].addr;
e7dbf7ad4172ef arch/x86/xen/setup.c  Ingo Molnar           2017-01-28  846  				size = xen_e820_table.entries[i].size;
5097cdf6cef154 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  847  			}
5097cdf6cef154 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  848  		}
35ae11fd146384 arch/x86/xen/setup.c  Ian Campbell          2009-02-06  849  	}
b792c755907cff arch/x86/xen/setup.c  Jeremy Fitzhardinge   2008-06-16  850  
25b884a83d487f arch/x86/xen/setup.c  David Vrabel          2014-01-03  851  	/*
25b884a83d487f arch/x86/xen/setup.c  David Vrabel          2014-01-03  852  	 * Set the rest as identity mapped, in case PCI BARs are
25b884a83d487f arch/x86/xen/setup.c  David Vrabel          2014-01-03  853  	 * located here.
25b884a83d487f arch/x86/xen/setup.c  David Vrabel          2014-01-03  854  	 */
5097cdf6cef154 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  855  	set_phys_range_identity(addr / PAGE_SIZE, ~0ul);
25b884a83d487f arch/x86/xen/setup.c  David Vrabel          2014-01-03  856  
b792c755907cff arch/x86/xen/setup.c  Jeremy Fitzhardinge   2008-06-16  857  	/*
9ec23a7f6d2537 arch/x86/xen/setup.c  Ian Campbell          2010-10-28  858  	 * In domU, the ISA region is normal, usable memory, but we
9ec23a7f6d2537 arch/x86/xen/setup.c  Ian Campbell          2010-10-28  859  	 * reserve ISA memory anyway because too many things poke
b792c755907cff arch/x86/xen/setup.c  Jeremy Fitzhardinge   2008-06-16  860  	 * about in there.
b792c755907cff arch/x86/xen/setup.c  Jeremy Fitzhardinge   2008-06-16  861  	 */
f9748fa0458510 arch/x86/xen/setup.c  Ingo Molnar           2017-01-28  862  	e820__range_add(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS, E820_TYPE_RESERVED);
5ead97c84fa7d6 arch/i386/xen/setup.c Jeremy Fitzhardinge   2007-07-17  863  
f9748fa0458510 arch/x86/xen/setup.c  Ingo Molnar           2017-01-28  864  	e820__update_table(e820_table);
be5bf9fa1c327f arch/x86/xen/setup.c  Jeremy Fitzhardinge   2008-06-16  865  
808fdb71936c41 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  866  	/*
808fdb71936c41 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  867  	 * Check whether the kernel itself conflicts with the target E820 map.
808fdb71936c41 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  868  	 * Failing now is better than running into weird problems later due
808fdb71936c41 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  869  	 * to relocating (and even reusing) pages with kernel text or data.
808fdb71936c41 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  870  	 */
808fdb71936c41 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  871  	if (xen_is_e820_reserved(__pa_symbol(_text),
808fdb71936c41 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  872  			__pa_symbol(__bss_stop) - __pa_symbol(_text))) {
808fdb71936c41 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  873  		xen_raw_console_write("Xen hypervisor allocated kernel memory conflicts with E820 map\n");
808fdb71936c41 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  874  		BUG();
808fdb71936c41 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  875  	}
808fdb71936c41 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  876  
04414baab5ba86 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  877  	/*
04414baab5ba86 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  878  	 * Check for a conflict of the hypervisor supplied page tables with
04414baab5ba86 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  879  	 * the target E820 map.
04414baab5ba86 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  880  	 */
04414baab5ba86 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  881  	xen_pt_check_e820();
04414baab5ba86 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  882  
8f5b0c63987207 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  883  	xen_reserve_xen_mfnlist();
8f5b0c63987207 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  884  
4b9c15377f96e2 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  885  	/* Check for a conflict of the initrd with the target E820 map. */
4b9c15377f96e2 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  886  	if (xen_is_e820_reserved(boot_params.hdr.ramdisk_image,
4b9c15377f96e2 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  887  				 boot_params.hdr.ramdisk_size)) {
4b9c15377f96e2 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  888  		phys_addr_t new_area, start, size;
4b9c15377f96e2 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  889  
4b9c15377f96e2 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  890  		new_area = xen_find_free_area(boot_params.hdr.ramdisk_size);
4b9c15377f96e2 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  891  		if (!new_area) {
4b9c15377f96e2 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  892  			xen_raw_console_write("Can't find new memory area for initrd needed due to E820 map conflict\n");
4b9c15377f96e2 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  893  			BUG();
4b9c15377f96e2 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  894  		}
4b9c15377f96e2 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  895  
4b9c15377f96e2 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  896  		start = boot_params.hdr.ramdisk_image;
4b9c15377f96e2 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  897  		size = boot_params.hdr.ramdisk_size;
4b9c15377f96e2 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  898  		xen_phys_memcpy(new_area, start, size);
4b9c15377f96e2 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  899  		pr_info("initrd moved from [mem %#010llx-%#010llx] to [mem %#010llx-%#010llx]\n",
4b9c15377f96e2 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  900  			start, start + size, new_area, new_area + size);
3ecc68349bbab6 arch/x86/xen/setup.c  Mike Rapoport         2021-11-05  901  		memblock_phys_free(start, size);
4b9c15377f96e2 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  902  		boot_params.hdr.ramdisk_image = new_area;
4b9c15377f96e2 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  903  		boot_params.ext_ramdisk_image = new_area >> 32;
4b9c15377f96e2 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  904  	}
4b9c15377f96e2 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  905  
5097cdf6cef154 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  906  	/*
5097cdf6cef154 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  907  	 * Set identity map on non-RAM pages and prepare remapping the
5097cdf6cef154 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  908  	 * underlying RAM.
5097cdf6cef154 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  909  	 */
dd14be92fbf5bc arch/x86/xen/setup.c  Juergen Gross         2016-05-18  910  	xen_foreach_remap_area(max_pfn, xen_set_identity_and_remap_chunk);
dd14be92fbf5bc arch/x86/xen/setup.c  Juergen Gross         2016-05-18  911  
dd14be92fbf5bc arch/x86/xen/setup.c  Juergen Gross         2016-05-18  912  	pr_info("Released %ld page(s)\n", xen_released_pages);
5097cdf6cef154 arch/x86/xen/setup.c  Juergen Gross         2015-07-17  913  
5ead97c84fa7d6 arch/i386/xen/setup.c Jeremy Fitzhardinge   2007-07-17  914  	return "Xen";
5ead97c84fa7d6 arch/i386/xen/setup.c Jeremy Fitzhardinge   2007-07-17  915  }
5ead97c84fa7d6 arch/i386/xen/setup.c Jeremy Fitzhardinge   2007-07-17  916  

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

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [PATCH next v4 2/5] minmax: Allow min()/max()/clamp() if the arguments have the same signedness.
@ 2023-09-26  6:27 kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2023-09-26  6:27 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "low confidence static check first_new_problem: drivers/media/pci/solo6x10/solo6x10-core.c:362:24: sparse: sparse: too long token expansion"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <fe7e6c542e094bfca655abcd323c1c98@AcuMS.aculab.com>
References: <fe7e6c542e094bfca655abcd323c1c98@AcuMS.aculab.com>
TO: David Laight <David.Laight@ACULAB.COM>
TO: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
CC: "'Andy Shevchenko'" <andriy.shevchenko@linux.intel.com>
CC: "'Andrew Morton'" <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>
CC: "'Matthew Wilcox (Oracle)'" <willy@infradead.org>
CC: "'Christoph Hellwig'" <hch@infradead.org>
CC: "'Jason A. Donenfeld'" <Jason@zx2c4.com>

Hi David,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linux/master]
[also build test WARNING on linus/master v6.6-rc3]
[cannot apply to next-20230918 next-20230925]
[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/David-Laight/minmax-Add-umin-a-b-and-umax-a-b/20230918-162441
base:   linux/master
patch link:    https://lore.kernel.org/r/fe7e6c542e094bfca655abcd323c1c98%40AcuMS.aculab.com
patch subject: [PATCH next v4 2/5] minmax: Allow min()/max()/clamp() if the arguments have the same signedness.
:::::: branch date: 8 days ago
:::::: commit date: 8 days ago
config: i386-randconfig-061-20230926 (https://download.01.org/0day-ci/archive/20230926/202309261405.qSNuGpjv-lkp@intel.com/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/20230926/202309261405.qSNuGpjv-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/r/202309261405.qSNuGpjv-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/media/pci/solo6x10/solo6x10-core.c:362:24: sparse: sparse: too long token expansion
>> drivers/media/pci/solo6x10/solo6x10-core.c:362:24: sparse: sparse: too long token expansion
>> drivers/media/pci/solo6x10/solo6x10-core.c:362:24: sparse: sparse: too long token expansion
>> drivers/media/pci/solo6x10/solo6x10-core.c:362:24: sparse: sparse: too long token expansion
--
>> drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c:468:30: sparse: sparse: too long token expansion
>> drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c:468:30: sparse: sparse: too long token expansion
>> drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c:468:30: sparse: sparse: too long token expansion
>> drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c:468:30: sparse: sparse: too long token expansion
--
>> drivers/media/pci/solo6x10/solo6x10-p2m.c:309:13: sparse: sparse: too long token expansion
>> drivers/media/pci/solo6x10/solo6x10-p2m.c:309:13: sparse: sparse: too long token expansion
>> drivers/media/pci/solo6x10/solo6x10-p2m.c:309:13: sparse: sparse: too long token expansion
>> drivers/media/pci/solo6x10/solo6x10-p2m.c:309:13: sparse: sparse: too long token expansion
   drivers/media/pci/solo6x10/solo6x10-p2m.c:310:17: sparse: sparse: too long token expansion
   drivers/media/pci/solo6x10/solo6x10-p2m.c:310:17: sparse: sparse: too long token expansion
   drivers/media/pci/solo6x10/solo6x10-p2m.c:310:17: sparse: sparse: too long token expansion
   drivers/media/pci/solo6x10/solo6x10-p2m.c:310:17: sparse: sparse: too long token expansion
--
>> drivers/media/pci/solo6x10/solo6x10-enc.c:245:18: sparse: sparse: too long token expansion
>> drivers/media/pci/solo6x10/solo6x10-enc.c:245:18: sparse: sparse: too long token expansion
>> drivers/media/pci/solo6x10/solo6x10-enc.c:245:18: sparse: sparse: too long token expansion
>> drivers/media/pci/solo6x10/solo6x10-enc.c:245:18: sparse: sparse: too long token expansion
   drivers/media/pci/solo6x10/solo6x10-enc.c:270:24: sparse: sparse: too long token expansion
   drivers/media/pci/solo6x10/solo6x10-enc.c:270:24: sparse: sparse: too long token expansion
   drivers/media/pci/solo6x10/solo6x10-enc.c:270:24: sparse: sparse: too long token expansion
   drivers/media/pci/solo6x10/solo6x10-enc.c:270:24: sparse: sparse: too long token expansion

vim +362 drivers/media/pci/solo6x10/solo6x10-core.c

dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  316  
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  317  static ssize_t sdram_offsets_show(struct device *dev,
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  318  				  struct device_attribute *attr,
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  319  				  char *buf)
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  320  {
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  321  	struct solo_dev *solo_dev =
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  322  		container_of(dev, struct solo_dev, dev);
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  323  	char *out = buf;
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  324  
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  325  	out += sprintf(out, "DISP: 0x%08x @ 0x%08x\n",
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  326  		       SOLO_DISP_EXT_ADDR,
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  327  		       SOLO_DISP_EXT_SIZE);
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  328  
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  329  	out += sprintf(out, "EOSD: 0x%08x @ 0x%08x (0x%08x * %d)\n",
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  330  		       SOLO_EOSD_EXT_ADDR,
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  331  		       SOLO_EOSD_EXT_AREA(solo_dev),
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  332  		       SOLO_EOSD_EXT_SIZE(solo_dev),
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  333  		       SOLO_EOSD_EXT_AREA(solo_dev) /
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  334  		       SOLO_EOSD_EXT_SIZE(solo_dev));
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  335  
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  336  	out += sprintf(out, "MOTI: 0x%08x @ 0x%08x\n",
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  337  		       SOLO_MOTION_EXT_ADDR(solo_dev),
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  338  		       SOLO_MOTION_EXT_SIZE);
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  339  
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  340  	out += sprintf(out, "G723: 0x%08x @ 0x%08x\n",
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  341  		       SOLO_G723_EXT_ADDR(solo_dev),
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  342  		       SOLO_G723_EXT_SIZE);
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  343  
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  344  	out += sprintf(out, "CAPT: 0x%08x @ 0x%08x (0x%08x * %d)\n",
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  345  		       SOLO_CAP_EXT_ADDR(solo_dev),
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  346  		       SOLO_CAP_EXT_SIZE(solo_dev),
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  347  		       SOLO_CAP_PAGE_SIZE,
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  348  		       SOLO_CAP_EXT_SIZE(solo_dev) / SOLO_CAP_PAGE_SIZE);
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  349  
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  350  	out += sprintf(out, "EREF: 0x%08x @ 0x%08x (0x%08x * %d)\n",
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  351  		       SOLO_EREF_EXT_ADDR(solo_dev),
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  352  		       SOLO_EREF_EXT_AREA(solo_dev),
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  353  		       SOLO_EREF_EXT_SIZE,
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  354  		       SOLO_EREF_EXT_AREA(solo_dev) / SOLO_EREF_EXT_SIZE);
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  355  
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  356  	out += sprintf(out, "MPEG: 0x%08x @ 0x%08x\n",
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  357  		       SOLO_MP4E_EXT_ADDR(solo_dev),
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  358  		       SOLO_MP4E_EXT_SIZE(solo_dev));
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  359  
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  360  	out += sprintf(out, "JPEG: 0x%08x @ 0x%08x\n",
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  361  		       SOLO_JPEG_EXT_ADDR(solo_dev),
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25 @362  		       SOLO_JPEG_EXT_SIZE(solo_dev));
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  363  
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  364  	return out - buf;
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  365  }
dcae5dacbce518 drivers/staging/media/solo6x10/core.c Hans Verkuil 2013-03-25  366  

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

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [PATCH next v4 2/5] minmax: Allow min()/max()/clamp() if the arguments have the same signedness.
@ 2023-09-22 13:13 kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2023-09-22 13:13 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "low confidence static check first_new_problem: drivers/net/ethernet/engleder/tsnep_main.c:1547:25: sparse: sparse: too long token expansion"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <fe7e6c542e094bfca655abcd323c1c98@AcuMS.aculab.com>
References: <fe7e6c542e094bfca655abcd323c1c98@AcuMS.aculab.com>
TO: David Laight <David.Laight@ACULAB.COM>
TO: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
CC: "'Andy Shevchenko'" <andriy.shevchenko@linux.intel.com>
CC: "'Andrew Morton'" <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>
CC: "'Matthew Wilcox (Oracle)'" <willy@infradead.org>
CC: "'Christoph Hellwig'" <hch@infradead.org>
CC: "'Jason A. Donenfeld'" <Jason@zx2c4.com>

Hi David,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linux/master]
[also build test WARNING on linus/master v6.6-rc2]
[cannot apply to next-20230918 next-20230921]
[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/David-Laight/minmax-Add-umin-a-b-and-umax-a-b/20230918-162441
base:   linux/master
patch link:    https://lore.kernel.org/r/fe7e6c542e094bfca655abcd323c1c98%40AcuMS.aculab.com
patch subject: [PATCH next v4 2/5] minmax: Allow min()/max()/clamp() if the arguments have the same signedness.
:::::: branch date: 4 days ago
:::::: commit date: 4 days ago
config: x86_64-randconfig-122-20230922 (https://download.01.org/0day-ci/archive/20230922/202309222002.aSjj9A5w-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230922/202309222002.aSjj9A5w-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/r/202309222002.aSjj9A5w-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/engleder/tsnep_main.c:1547:25: sparse: sparse: too long token expansion

vim +1547 drivers/net/ethernet/engleder/tsnep_main.c

403f69bbdbadb2 Gerhard Engleder 2021-11-19  1457  
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1458  static int tsnep_rx_poll_zc(struct tsnep_rx *rx, struct napi_struct *napi,
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1459  			    int budget)
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1460  {
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1461  	struct tsnep_rx_entry *entry;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1462  	struct netdev_queue *tx_nq;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1463  	struct bpf_prog *prog;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1464  	struct tsnep_tx *tx;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1465  	int desc_available;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1466  	int xdp_status = 0;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1467  	struct page *page;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1468  	int done = 0;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1469  	int length;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1470  
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1471  	desc_available = tsnep_rx_desc_available(rx);
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1472  	prog = READ_ONCE(rx->adapter->xdp_prog);
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1473  	if (prog) {
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1474  		tx_nq = netdev_get_tx_queue(rx->adapter->netdev,
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1475  					    rx->tx_queue_index);
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1476  		tx = &rx->adapter->tx[rx->tx_queue_index];
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1477  	}
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1478  
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1479  	while (likely(done < budget) && (rx->read != rx->write)) {
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1480  		entry = &rx->entry[rx->read];
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1481  		if ((__le32_to_cpu(entry->desc_wb->properties) &
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1482  		     TSNEP_DESC_OWNER_COUNTER_MASK) !=
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1483  		    (entry->properties & TSNEP_DESC_OWNER_COUNTER_MASK))
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1484  			break;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1485  		done++;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1486  
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1487  		if (desc_available >= TSNEP_RING_RX_REFILL) {
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1488  			bool reuse = desc_available >= TSNEP_RING_RX_REUSE;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1489  
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1490  			desc_available -= tsnep_rx_refill_zc(rx, desc_available,
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1491  							     reuse);
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1492  			if (!entry->xdp) {
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1493  				/* buffer has been reused for refill to prevent
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1494  				 * empty RX ring, thus buffer cannot be used for
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1495  				 * RX processing
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1496  				 */
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1497  				rx->read = (rx->read + 1) & TSNEP_RING_MASK;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1498  				desc_available++;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1499  
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1500  				rx->dropped++;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1501  
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1502  				continue;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1503  			}
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1504  		}
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1505  
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1506  		/* descriptor properties shall be read first, because valid data
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1507  		 * is signaled there
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1508  		 */
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1509  		dma_rmb();
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1510  
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1511  		prefetch(entry->xdp->data);
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1512  		length = __le32_to_cpu(entry->desc_wb->properties) &
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1513  			 TSNEP_DESC_LENGTH_MASK;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1514  		xsk_buff_set_size(entry->xdp, length);
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1515  		xsk_buff_dma_sync_for_cpu(entry->xdp, rx->xsk_pool);
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1516  
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1517  		/* RX metadata with timestamps is in front of actual data,
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1518  		 * subtract metadata size to get length of actual data and
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1519  		 * consider metadata size as offset of actual data during RX
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1520  		 * processing
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1521  		 */
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1522  		length -= TSNEP_RX_INLINE_METADATA_SIZE;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1523  
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1524  		rx->read = (rx->read + 1) & TSNEP_RING_MASK;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1525  		desc_available++;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1526  
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1527  		if (prog) {
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1528  			bool consume;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1529  
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1530  			entry->xdp->data += TSNEP_RX_INLINE_METADATA_SIZE;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1531  			entry->xdp->data_meta += TSNEP_RX_INLINE_METADATA_SIZE;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1532  
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1533  			consume = tsnep_xdp_run_prog_zc(rx, prog, entry->xdp,
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1534  							&xdp_status, tx_nq, tx);
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1535  			if (consume) {
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1536  				rx->packets++;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1537  				rx->bytes += length;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1538  
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1539  				entry->xdp = NULL;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1540  
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1541  				continue;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1542  			}
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1543  		}
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1544  
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1545  		page = page_pool_dev_alloc_pages(rx->page_pool);
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1546  		if (page) {
3fc2333933fdf1 Gerhard Engleder 2023-04-21 @1547  			memcpy(page_address(page) + TSNEP_RX_OFFSET,
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1548  			       entry->xdp->data - TSNEP_RX_INLINE_METADATA_SIZE,
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1549  			       length + TSNEP_RX_INLINE_METADATA_SIZE);
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1550  			tsnep_rx_page(rx, napi, page, length);
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1551  		} else {
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1552  			rx->dropped++;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1553  		}
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1554  		xsk_buff_free(entry->xdp);
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1555  		entry->xdp = NULL;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1556  	}
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1557  
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1558  	if (xdp_status)
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1559  		tsnep_finalize_xdp(rx->adapter, xdp_status, tx_nq, tx);
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1560  
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1561  	if (desc_available)
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1562  		desc_available -= tsnep_rx_refill_zc(rx, desc_available, false);
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1563  
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1564  	if (xsk_uses_need_wakeup(rx->xsk_pool)) {
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1565  		if (desc_available)
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1566  			xsk_set_rx_need_wakeup(rx->xsk_pool);
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1567  		else
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1568  			xsk_clear_rx_need_wakeup(rx->xsk_pool);
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1569  
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1570  		return done;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1571  	}
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1572  
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1573  	return desc_available ? budget : done;
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1574  }
3fc2333933fdf1 Gerhard Engleder 2023-04-21  1575  

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

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [PATCH next v4 2/5] minmax: Allow min()/max()/clamp() if the arguments have the same signedness.
@ 2023-09-20 20:42 kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2023-09-20 20:42 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "low confidence static check first_new_problem: drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c:2045:35: sparse: sparse: too long token expansion"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <fe7e6c542e094bfca655abcd323c1c98@AcuMS.aculab.com>
References: <fe7e6c542e094bfca655abcd323c1c98@AcuMS.aculab.com>
TO: David Laight <David.Laight@ACULAB.COM>
TO: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
CC: "'Andy Shevchenko'" <andriy.shevchenko@linux.intel.com>
CC: "'Andrew Morton'" <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>
CC: "'Matthew Wilcox (Oracle)'" <willy@infradead.org>
CC: "'Christoph Hellwig'" <hch@infradead.org>
CC: "'Jason A. Donenfeld'" <Jason@zx2c4.com>

Hi David,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linux/master]
[also build test WARNING on linus/master v6.6-rc2]
[cannot apply to next-20230918 next-20230920]
[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/David-Laight/minmax-Add-umin-a-b-and-umax-a-b/20230918-162441
base:   linux/master
patch link:    https://lore.kernel.org/r/fe7e6c542e094bfca655abcd323c1c98%40AcuMS.aculab.com
patch subject: [PATCH next v4 2/5] minmax: Allow min()/max()/clamp() if the arguments have the same signedness.
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: i386-randconfig-062-20230920 (https://download.01.org/0day-ci/archive/20230921/202309210403.Jjt9vT1Z-lkp@intel.com/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/20230921/202309210403.Jjt9vT1Z-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/r/202309210403.Jjt9vT1Z-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c:2045:35: sparse: sparse: too long token expansion
>> drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c:2045:35: sparse: sparse: too long token expansion
   drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c:4543:32: sparse: sparse: too long token expansion
   drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c:4543:32: sparse: sparse: too long token expansion
--
>> drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c:3247:28: sparse: sparse: too long token expansion
>> drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c:3247:28: sparse: sparse: too long token expansion
--
>> drivers/net/wireless/ath/ath11k/mac.c:4701:15: sparse: sparse: too long token expansion
>> drivers/net/wireless/ath/ath11k/mac.c:4701:15: sparse: sparse: too long token expansion
   drivers/net/wireless/ath/ath11k/mac.c:8381:23: sparse: sparse: too long token expansion
   drivers/net/wireless/ath/ath11k/mac.c:8381:23: sparse: sparse: too long token expansion
--
>> drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: sparse: sparse: too long token expansion
>> drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: sparse: sparse: too long token expansion
>> drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: sparse: sparse: too long token expansion
>> drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:1133:29: sparse: sparse: too long token expansion

vim +2045 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c

ec6ba945211b1c drivers/net/bnx2x/bnx2x_cmn.c                   Vladislav Zolotarov 2010-12-13  2021  
1191cb83489e6e drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c Eric Dumazet        2012-04-27  2022  static void bnx2x_set_rx_buf_size(struct bnx2x *bp)
a8c94b9188bf60 drivers/net/bnx2x/bnx2x_cmn.c                   Vladislav Zolotarov 2011-02-06  2023  {
a8c94b9188bf60 drivers/net/bnx2x/bnx2x_cmn.c                   Vladislav Zolotarov 2011-02-06  2024  	int i;
a8c94b9188bf60 drivers/net/bnx2x/bnx2x_cmn.c                   Vladislav Zolotarov 2011-02-06  2025  
a8c94b9188bf60 drivers/net/bnx2x/bnx2x_cmn.c                   Vladislav Zolotarov 2011-02-06  2026  	for_each_queue(bp, i) {
a8c94b9188bf60 drivers/net/bnx2x/bnx2x_cmn.c                   Vladislav Zolotarov 2011-02-06  2027  		struct bnx2x_fastpath *fp = &bp->fp[i];
e52fcb2462ac48 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c Eric Dumazet        2011-11-14  2028  		u32 mtu;
a8c94b9188bf60 drivers/net/bnx2x/bnx2x_cmn.c                   Vladislav Zolotarov 2011-02-06  2029  
a8c94b9188bf60 drivers/net/bnx2x/bnx2x_cmn.c                   Vladislav Zolotarov 2011-02-06  2030  		/* Always use a mini-jumbo MTU for the FCoE L2 ring */
a8c94b9188bf60 drivers/net/bnx2x/bnx2x_cmn.c                   Vladislav Zolotarov 2011-02-06  2031  		if (IS_FCOE_IDX(i))
a8c94b9188bf60 drivers/net/bnx2x/bnx2x_cmn.c                   Vladislav Zolotarov 2011-02-06  2032  			/*
a8c94b9188bf60 drivers/net/bnx2x/bnx2x_cmn.c                   Vladislav Zolotarov 2011-02-06  2033  			 * Although there are no IP frames expected to arrive to
a8c94b9188bf60 drivers/net/bnx2x/bnx2x_cmn.c                   Vladislav Zolotarov 2011-02-06  2034  			 * this ring we still want to add an
a8c94b9188bf60 drivers/net/bnx2x/bnx2x_cmn.c                   Vladislav Zolotarov 2011-02-06  2035  			 * IP_HEADER_ALIGNMENT_PADDING to prevent a buffer
a8c94b9188bf60 drivers/net/bnx2x/bnx2x_cmn.c                   Vladislav Zolotarov 2011-02-06  2036  			 * overrun attack.
a8c94b9188bf60 drivers/net/bnx2x/bnx2x_cmn.c                   Vladislav Zolotarov 2011-02-06  2037  			 */
e52fcb2462ac48 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c Eric Dumazet        2011-11-14  2038  			mtu = BNX2X_FCOE_MINI_JUMBO_MTU;
a8c94b9188bf60 drivers/net/bnx2x/bnx2x_cmn.c                   Vladislav Zolotarov 2011-02-06  2039  		else
e52fcb2462ac48 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c Eric Dumazet        2011-11-14  2040  			mtu = bp->dev->mtu;
e52fcb2462ac48 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c Eric Dumazet        2011-11-14  2041  		fp->rx_buf_size = BNX2X_FW_RX_ALIGN_START +
e52fcb2462ac48 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c Eric Dumazet        2011-11-14  2042  				  IP_HEADER_ALIGNMENT_PADDING +
e1c6dccaf3af29 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c Jarod Wilson        2016-10-17  2043  				  ETH_OVERHEAD +
e52fcb2462ac48 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c Eric Dumazet        2011-11-14  2044  				  mtu +
e52fcb2462ac48 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c Eric Dumazet        2011-11-14 @2045  				  BNX2X_FW_RX_ALIGN_END;
9b70de6d026688 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c Scott Wood          2017-04-28  2046  		fp->rx_buf_size = SKB_DATA_ALIGN(fp->rx_buf_size);
16a5fd9265e757 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c Yuval Mintz         2013-06-02  2047  		/* Note : rx_buf_size doesn't take into account NET_SKB_PAD */
d46d132cc0212e drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c Eric Dumazet        2012-12-10  2048  		if (fp->rx_buf_size + NET_SKB_PAD <= PAGE_SIZE)
d46d132cc0212e drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c Eric Dumazet        2012-12-10  2049  			fp->rx_frag_size = fp->rx_buf_size + NET_SKB_PAD;
d46d132cc0212e drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c Eric Dumazet        2012-12-10  2050  		else
d46d132cc0212e drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c Eric Dumazet        2012-12-10  2051  			fp->rx_frag_size = 0;
619c5cb6885b93 drivers/net/bnx2x/bnx2x_cmn.c                   Vlad Zolotarov      2011-06-14  2052  	}
a8c94b9188bf60 drivers/net/bnx2x/bnx2x_cmn.c                   Vladislav Zolotarov 2011-02-06  2053  }
619c5cb6885b93 drivers/net/bnx2x/bnx2x_cmn.c                   Vlad Zolotarov      2011-06-14  2054  

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

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [PATCH next v4 2/5] minmax: Allow min()/max()/clamp() if the arguments have the same signedness.
@ 2023-09-18 22:51 kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2023-09-18 22:51 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "low confidence static check first_new_problem: fs/xfs/libxfs/xfs_trans_resv.c:341:39: sparse: sparse: too long token expansion"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <fe7e6c542e094bfca655abcd323c1c98@AcuMS.aculab.com>
References: <fe7e6c542e094bfca655abcd323c1c98@AcuMS.aculab.com>
TO: David Laight <David.Laight@ACULAB.COM>
TO: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
CC: "'Andy Shevchenko'" <andriy.shevchenko@linux.intel.com>
CC: "'Andrew Morton'" <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>
CC: "'Matthew Wilcox (Oracle)'" <willy@infradead.org>
CC: "'Christoph Hellwig'" <hch@infradead.org>
CC: "'Jason A. Donenfeld'" <Jason@zx2c4.com>

Hi David,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linux/master]
[also build test WARNING on linus/master v6.6-rc2]
[cannot apply to next-20230918 next-20230918]
[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/David-Laight/minmax-Add-umin-a-b-and-umax-a-b/20230918-162441
base:   linux/master
patch link:    https://lore.kernel.org/r/fe7e6c542e094bfca655abcd323c1c98%40AcuMS.aculab.com
patch subject: [PATCH next v4 2/5] minmax: Allow min()/max()/clamp() if the arguments have the same signedness.
:::::: branch date: 14 hours ago
:::::: commit date: 14 hours ago
config: i386-randconfig-061-20230919 (https://download.01.org/0day-ci/archive/20230919/202309190638.HbyAK8Y9-lkp@intel.com/config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230919/202309190638.HbyAK8Y9-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/r/202309190638.HbyAK8Y9-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> fs/xfs/libxfs/xfs_trans_resv.c:341:39: sparse: sparse: too long token expansion
>> fs/xfs/libxfs/xfs_trans_resv.c:341:39: sparse: sparse: too long token expansion
   fs/xfs/libxfs/xfs_trans_resv.c:413:39: sparse: sparse: too long token expansion
   fs/xfs/libxfs/xfs_trans_resv.c:413:39: sparse: sparse: too long token expansion
--
>> drivers/firmware/sysfb_simplefb.c:60:34: sparse: sparse: too long token expansion
>> drivers/firmware/sysfb_simplefb.c:60:34: sparse: sparse: too long token expansion

vim +341 fs/xfs/libxfs/xfs_trans_resv.c

7fd36c4418ee86 fs/xfs/xfs_trans_resv.c        Dave Chinner    2013-08-12  268  
7fd36c4418ee86 fs/xfs/xfs_trans_resv.c        Dave Chinner    2013-08-12  269  /*
7fd36c4418ee86 fs/xfs/xfs_trans_resv.c        Dave Chinner    2013-08-12  270   * In a write transaction we can allocate a maximum of 2
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  271   * extents.  This gives (t1):
7fd36c4418ee86 fs/xfs/xfs_trans_resv.c        Dave Chinner    2013-08-12  272   *    the inode getting the new extents: inode size
7fd36c4418ee86 fs/xfs/xfs_trans_resv.c        Dave Chinner    2013-08-12  273   *    the inode's bmap btree: max depth * block size
7fd36c4418ee86 fs/xfs/xfs_trans_resv.c        Dave Chinner    2013-08-12  274   *    the agfs of the ags from which the extents are allocated: 2 * sector
7fd36c4418ee86 fs/xfs/xfs_trans_resv.c        Dave Chinner    2013-08-12  275   *    the superblock free block counter: sector size
7fd36c4418ee86 fs/xfs/xfs_trans_resv.c        Dave Chinner    2013-08-12  276   *    the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  277   * Or, if we're writing to a realtime file (t2):
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  278   *    the inode getting the new extents: inode size
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  279   *    the inode's bmap btree: max depth * block size
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  280   *    the agfs of the ags from which the extents are allocated: 2 * sector
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  281   *    the superblock free block counter: sector size
95f0b95e2b686c fs/xfs/libxfs/xfs_trans_resv.c Chandan Babu R  2021-08-09  282   *    the realtime bitmap: ((XFS_BMBT_MAX_EXTLEN / rtextsize) / NBBY) bytes
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  283   *    the realtime summary: 1 block
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  284   *    the allocation btrees: 2 trees * (2 * max depth - 1) * block size
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  285   * And the bmap_finish transaction can free bmap blocks in a join (t3):
7fd36c4418ee86 fs/xfs/xfs_trans_resv.c        Dave Chinner    2013-08-12  286   *    the agfs of the ags containing the blocks: 2 * sector size
7fd36c4418ee86 fs/xfs/xfs_trans_resv.c        Dave Chinner    2013-08-12  287   *    the agfls of the ags containing the blocks: 2 * sector size
7fd36c4418ee86 fs/xfs/xfs_trans_resv.c        Dave Chinner    2013-08-12  288   *    the super block free block counter: sector size
7fd36c4418ee86 fs/xfs/xfs_trans_resv.c        Dave Chinner    2013-08-12  289   *    the allocation btrees: 2 exts * 2 trees * (2 * max depth - 1) * block size
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  290   * And any refcount updates that happen in a separate transaction (t4).
7fd36c4418ee86 fs/xfs/xfs_trans_resv.c        Dave Chinner    2013-08-12  291   */
7fd36c4418ee86 fs/xfs/xfs_trans_resv.c        Dave Chinner    2013-08-12  292  STATIC uint
7fd36c4418ee86 fs/xfs/xfs_trans_resv.c        Dave Chinner    2013-08-12  293  xfs_calc_write_reservation(
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  294  	struct xfs_mount	*mp,
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  295  	bool			for_minlogsize)
7fd36c4418ee86 fs/xfs/xfs_trans_resv.c        Dave Chinner    2013-08-12  296  {
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  297  	unsigned int		t1, t2, t3, t4;
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  298  	unsigned int		blksz = XFS_FSB_TO_B(mp, 1);
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  299  
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  300  	t1 = xfs_calc_inode_res(mp, 1) +
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  301  	     xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK), blksz) +
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  302  	     xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) +
6ed7e509d23045 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  303  	     xfs_calc_buf_res(xfs_allocfree_block_count(mp, 2), blksz);
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  304  
ebd9027d088b3a fs/xfs/libxfs/xfs_trans_resv.c Dave Chinner    2021-08-18  305  	if (xfs_has_realtime(mp)) {
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  306  		t2 = xfs_calc_inode_res(mp, 1) +
7fd36c4418ee86 fs/xfs/xfs_trans_resv.c        Dave Chinner    2013-08-12  307  		     xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK),
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  308  				     blksz) +
7fd36c4418ee86 fs/xfs/xfs_trans_resv.c        Dave Chinner    2013-08-12  309  		     xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) +
6ed7e509d23045 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  310  		     xfs_calc_buf_res(xfs_rtalloc_block_count(mp, 1), blksz) +
6ed7e509d23045 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  311  		     xfs_calc_buf_res(xfs_allocfree_block_count(mp, 1), blksz);
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  312  	} else {
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  313  		t2 = 0;
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  314  	}
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  315  
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  316  	t3 = xfs_calc_buf_res(5, mp->m_sb.sb_sectsize) +
6ed7e509d23045 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  317  	     xfs_calc_buf_res(xfs_allocfree_block_count(mp, 2), blksz);
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  318  
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  319  	/*
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  320  	 * In the early days of reflink, we included enough reservation to log
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  321  	 * two refcountbt splits for each transaction.  The codebase runs
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  322  	 * refcountbt updates in separate transactions now, so to compute the
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  323  	 * minimum log size, add the refcountbtree splits back to t1 and t3 and
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  324  	 * do not account them separately as t4.  Reflink did not support
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  325  	 * realtime when the reservations were established, so no adjustment to
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  326  	 * t2 is needed.
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  327  	 */
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  328  	if (for_minlogsize) {
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  329  		unsigned int	adj = 0;
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  330  
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  331  		if (xfs_has_reflink(mp))
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  332  			adj = xfs_calc_buf_res(
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  333  					xfs_refcountbt_block_count(mp, 2),
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  334  					blksz);
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  335  		t1 += adj;
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  336  		t3 += adj;
b1de6fc7520fe1 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2019-12-11  337  		return XFS_DQUOT_LOGRES(mp) + max3(t1, t2, t3);
7fd36c4418ee86 fs/xfs/xfs_trans_resv.c        Dave Chinner    2013-08-12  338  	}
7fd36c4418ee86 fs/xfs/xfs_trans_resv.c        Dave Chinner    2013-08-12  339  
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  340  	t4 = xfs_calc_refcountbt_reservation(mp, 1);
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25 @341  	return XFS_DQUOT_LOGRES(mp) + max(t4, max3(t1, t2, t3));
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  342  }
b037c4eed2df45 fs/xfs/libxfs/xfs_trans_resv.c Darrick J. Wong 2022-04-25  343  

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

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [PATCH next v4 2/5] minmax: Allow min()/max()/clamp() if the arguments have the same signedness.
@ 2023-09-18 22:00 kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2023-09-18 22:00 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "low confidence static check first_new_problem: drivers/hwmon/adm1026.c:609:28: sparse: sparse: too long token expansion"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <fe7e6c542e094bfca655abcd323c1c98@AcuMS.aculab.com>
References: <fe7e6c542e094bfca655abcd323c1c98@AcuMS.aculab.com>
TO: David Laight <David.Laight@ACULAB.COM>
TO: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
CC: "'Andy Shevchenko'" <andriy.shevchenko@linux.intel.com>
CC: "'Andrew Morton'" <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>
CC: "'Matthew Wilcox (Oracle)'" <willy@infradead.org>
CC: "'Christoph Hellwig'" <hch@infradead.org>
CC: "'Jason A. Donenfeld'" <Jason@zx2c4.com>

Hi David,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linux/master]
[also build test WARNING on linus/master v6.6-rc2]
[cannot apply to next-20230918 next-20230918]
[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/David-Laight/minmax-Add-umin-a-b-and-umax-a-b/20230918-162441
base:   linux/master
patch link:    https://lore.kernel.org/r/fe7e6c542e094bfca655abcd323c1c98%40AcuMS.aculab.com
patch subject: [PATCH next v4 2/5] minmax: Allow min()/max()/clamp() if the arguments have the same signedness.
:::::: branch date: 13 hours ago
:::::: commit date: 13 hours ago
config: i386-randconfig-062-20230919 (https://download.01.org/0day-ci/archive/20230919/202309190520.8GFDnhaY-lkp@intel.com/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/20230919/202309190520.8GFDnhaY-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/r/202309190520.8GFDnhaY-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/hwmon/adm1026.c:609:28: sparse: sparse: too long token expansion
>> drivers/hwmon/adm1026.c:609:28: sparse: sparse: too long token expansion
>> drivers/hwmon/adm1026.c:609:28: sparse: sparse: too long token expansion
   drivers/hwmon/adm1026.c:638:28: sparse: sparse: too long token expansion
   drivers/hwmon/adm1026.c:638:28: sparse: sparse: too long token expansion
   drivers/hwmon/adm1026.c:638:28: sparse: sparse: too long token expansion
--
>> arch/x86/kernel/cpu/cacheinfo.c:341:24: sparse: sparse: too long token expansion
>> arch/x86/kernel/cpu/cacheinfo.c:341:24: sparse: sparse: too long token expansion

vim +609 drivers/hwmon/adm1026.c

7ded2315ffe2b5 drivers/hwmon/adm1026.c     Guenter Roeck  2019-01-21  580  
7ded2315ffe2b5 drivers/hwmon/adm1026.c     Guenter Roeck  2019-01-21  581  static ssize_t in16_show(struct device *dev, struct device_attribute *attr,
86aa3e22106be3 drivers/hwmon/adm1026.c     Guenter Roeck  2012-01-14  582  			 char *buf)
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  583  {
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  584  	struct adm1026_data *data = adm1026_update_device(dev);
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  585  	return sprintf(buf, "%d\n", INS_FROM_REG(16, data->in[16]) -
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  586  		NEG12_OFFSET);
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  587  }
7ded2315ffe2b5 drivers/hwmon/adm1026.c     Guenter Roeck  2019-01-21  588  static ssize_t in16_min_show(struct device *dev,
7ded2315ffe2b5 drivers/hwmon/adm1026.c     Guenter Roeck  2019-01-21  589  			     struct device_attribute *attr, char *buf)
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  590  {
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  591  	struct adm1026_data *data = adm1026_update_device(dev);
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  592  	return sprintf(buf, "%d\n", INS_FROM_REG(16, data->in_min[16])
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  593  		- NEG12_OFFSET);
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  594  }
7ded2315ffe2b5 drivers/hwmon/adm1026.c     Guenter Roeck  2019-01-21  595  static ssize_t in16_min_store(struct device *dev,
7ded2315ffe2b5 drivers/hwmon/adm1026.c     Guenter Roeck  2019-01-21  596  			      struct device_attribute *attr, const char *buf,
7ded2315ffe2b5 drivers/hwmon/adm1026.c     Guenter Roeck  2019-01-21  597  			      size_t count)
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  598  {
b591d3c1964e7c drivers/hwmon/adm1026.c     Axel Lin       2014-07-03  599  	struct adm1026_data *data = dev_get_drvdata(dev);
b591d3c1964e7c drivers/hwmon/adm1026.c     Axel Lin       2014-07-03  600  	struct i2c_client *client = data->client;
86aa3e22106be3 drivers/hwmon/adm1026.c     Guenter Roeck  2012-01-14  601  	long val;
86aa3e22106be3 drivers/hwmon/adm1026.c     Guenter Roeck  2012-01-14  602  	int err;
86aa3e22106be3 drivers/hwmon/adm1026.c     Guenter Roeck  2012-01-14  603  
86aa3e22106be3 drivers/hwmon/adm1026.c     Guenter Roeck  2012-01-14  604  	err = kstrtol(buf, 10, &val);
86aa3e22106be3 drivers/hwmon/adm1026.c     Guenter Roeck  2012-01-14  605  	if (err)
86aa3e22106be3 drivers/hwmon/adm1026.c     Guenter Roeck  2012-01-14  606  		return err;
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  607  
9a61bf6300533d drivers/hwmon/adm1026.c     Ingo Molnar    2006-01-18  608  	mutex_lock(&data->update_lock);
f1b9baa99bd98f drivers/hwmon/adm1026.c     Guenter Roeck  2016-12-03 @609  	data->in_min[16] = INS_TO_REG(16,
f1b9baa99bd98f drivers/hwmon/adm1026.c     Guenter Roeck  2016-12-03  610  				      clamp_val(val, INT_MIN,
f1b9baa99bd98f drivers/hwmon/adm1026.c     Guenter Roeck  2016-12-03  611  						INT_MAX - NEG12_OFFSET) +
f1b9baa99bd98f drivers/hwmon/adm1026.c     Guenter Roeck  2016-12-03  612  				      NEG12_OFFSET);
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  613  	adm1026_write_value(client, ADM1026_REG_IN_MIN[16], data->in_min[16]);
9a61bf6300533d drivers/hwmon/adm1026.c     Ingo Molnar    2006-01-18  614  	mutex_unlock(&data->update_lock);
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  615  	return count;
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  616  }
7ded2315ffe2b5 drivers/hwmon/adm1026.c     Guenter Roeck  2019-01-21  617  static ssize_t in16_max_show(struct device *dev,
7ded2315ffe2b5 drivers/hwmon/adm1026.c     Guenter Roeck  2019-01-21  618  			     struct device_attribute *attr, char *buf)
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  619  {
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  620  	struct adm1026_data *data = adm1026_update_device(dev);
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  621  	return sprintf(buf, "%d\n", INS_FROM_REG(16, data->in_max[16])
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  622  			- NEG12_OFFSET);
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  623  }
7ded2315ffe2b5 drivers/hwmon/adm1026.c     Guenter Roeck  2019-01-21  624  static ssize_t in16_max_store(struct device *dev,
7ded2315ffe2b5 drivers/hwmon/adm1026.c     Guenter Roeck  2019-01-21  625  			      struct device_attribute *attr, const char *buf,
7ded2315ffe2b5 drivers/hwmon/adm1026.c     Guenter Roeck  2019-01-21  626  			      size_t count)
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  627  {
b591d3c1964e7c drivers/hwmon/adm1026.c     Axel Lin       2014-07-03  628  	struct adm1026_data *data = dev_get_drvdata(dev);
b591d3c1964e7c drivers/hwmon/adm1026.c     Axel Lin       2014-07-03  629  	struct i2c_client *client = data->client;
86aa3e22106be3 drivers/hwmon/adm1026.c     Guenter Roeck  2012-01-14  630  	long val;
86aa3e22106be3 drivers/hwmon/adm1026.c     Guenter Roeck  2012-01-14  631  	int err;
86aa3e22106be3 drivers/hwmon/adm1026.c     Guenter Roeck  2012-01-14  632  
86aa3e22106be3 drivers/hwmon/adm1026.c     Guenter Roeck  2012-01-14  633  	err = kstrtol(buf, 10, &val);
86aa3e22106be3 drivers/hwmon/adm1026.c     Guenter Roeck  2012-01-14  634  	if (err)
86aa3e22106be3 drivers/hwmon/adm1026.c     Guenter Roeck  2012-01-14  635  		return err;
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  636  
9a61bf6300533d drivers/hwmon/adm1026.c     Ingo Molnar    2006-01-18  637  	mutex_lock(&data->update_lock);
f1b9baa99bd98f drivers/hwmon/adm1026.c     Guenter Roeck  2016-12-03  638  	data->in_max[16] = INS_TO_REG(16,
f1b9baa99bd98f drivers/hwmon/adm1026.c     Guenter Roeck  2016-12-03  639  				      clamp_val(val, INT_MIN,
f1b9baa99bd98f drivers/hwmon/adm1026.c     Guenter Roeck  2016-12-03  640  						INT_MAX - NEG12_OFFSET) +
f1b9baa99bd98f drivers/hwmon/adm1026.c     Guenter Roeck  2016-12-03  641  				      NEG12_OFFSET);
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  642  	adm1026_write_value(client, ADM1026_REG_IN_MAX[16], data->in_max[16]);
9a61bf6300533d drivers/hwmon/adm1026.c     Ingo Molnar    2006-01-18  643  	mutex_unlock(&data->update_lock);
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  644  	return count;
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  645  }
^1da177e4c3f41 drivers/i2c/chips/adm1026.c Linus Torvalds 2005-04-16  646  

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

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH next v4 0/5] minmax: Relax type checks in min() and max().
@ 2023-09-18  8:14 David Laight
  2023-09-18  8:17 ` [PATCH next v4 2/5] minmax: Allow min()/max()/clamp() if the arguments have the same signedness David Laight
  0 siblings, 1 reply; 7+ messages in thread
From: David Laight @ 2023-09-18  8:14 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org
  Cc: Linus Torvalds, 'Andy Shevchenko',
	'Andrew Morton', 'Matthew Wilcox (Oracle)',
	'Christoph Hellwig', 'Jason A. Donenfeld'

The min() (etc) functions in minmax.h require that the arguments have
exactly the same types.

However when the type check fails, rather than look at the types and
fix the type of a variable/constant, everyone seems to jump on min_t().
In reality min_t() ought to be rare - when something unusual is being
done, not normality.

The orginal min() (added in 2.4.9) replaced several inline functions and
included the type - so matched the implicit casting of the function call.
This was renamed min_t() in 2.4.10 and the current min() added.
There is no actual indication that the conversion of negatve values
to large unsigned values has ever been an actual problem.

A quick grep shows 5734 min() and 4597 min_t().
Having the casts on almost half of the calls shows that something
is clearly wrong.

If the wrong type is picked (and it is far too easy to pick the type
of the result instead of the larger input) then significant bits can
get discarded.
Pretty much the worst example is in the derived clamp_val(), consider:
        unsigned char x = 200u;
        y = clamp_val(x, 10u, 300u);

I also suspect that many of the min_t(u16, ...) are actually wrong.
For example copy_data() in printk_ringbuffer.c contains:
        data_size = min_t(u16, buf_size, len);
Here buf_size is 'unsigned int' and len 'u16', pass a 64k buffer
(can you prove that doesn't happen?) and no data is returned.
Apparantly it did - and has since been fixed.

The only reason that most of the min_t() are 'fine' is that pretty
much all the values in the kernel are between 0 and INT_MAX.

Patch 1 adds umin(), this uses integer promotions to convert
both arguments to 'unsigned long long'. It can be used to compare a
signed type that is known to contain a non-negative value with an
unsigned type. The compiler typically optimises it all away.
Added first so that it can be referred to in patch 2.

Patch 2 replaces the 'same type' check with a 'same signedness' one.
This makes min(unsigned_int_var, sizeof()) be ok.
The error message is also improved and will contain the expanded
form of both arguments (useful for seeing how constants are defined).

Patch 3 just fixes some whitespace.

Patch 4 allows comparisons of 'unsigned char' and 'unsigned short'
to signed types. The integer promotion rules convert them both
to 'signed int' prior to the comparison so they can never cause
a negative value be converted to a large positive one.

Patch 5 (rewritted for v4) allows comparisons of unsigned values
against non-negative constant integer expressions.
This makes min(unsigned_int_var, 4) be ok.

The only common case that is still errored is the comparison of
signed values against unsigned constant integer expressions
below __INT_MAX__.
Typcally min(int_val, sizeof (foo)), the real fix for this is casting
the constant: min(int_var, (int)sizeof (foo)).

With all the patches applied pretty much all the min_t() could be
replaced by min(), and most of the rest by umin().
However they all need careful inspection due to code like:
        sz = min_t(unsigned char, sz - 1, LIM - 1) + 1;
which converts 0 to LIM.

v4: Patch 5 no longer allows min(int_var, 4u), only min(uint_var, 4).
    min_unsigned() rename umin().
    Rebased on 6.6-rc1.
v3: Fix more issues found by the build robot
v2: Fixes some issues found by the kernel build robot.

David Laight (5):
  minmax: Add umin(a, b) and umax(a, b)
  minmax: Allow min()/max()/clamp() if the arguments have the same
    signedness.
  minmax: Fix indentation of __cmp_once() and __clamp_once()
  minmax: Allow comparisons of 'int' against 'unsigned char/short'.
  minmax: Relax check to allow comparison between unsigned arguments and
    signed constants.

 include/linux/minmax.h | 103 +++++++++++++++++++++++++++--------------
 1 file changed, 68 insertions(+), 35 deletions(-)

-- 
2.17.1

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-09-26  6:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-19  2:28 [PATCH next v4 2/5] minmax: Allow min()/max()/clamp() if the arguments have the same signedness kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2023-09-26  6:27 kernel test robot
2023-09-22 13:13 kernel test robot
2023-09-20 20:42 kernel test robot
2023-09-18 22:51 kernel test robot
2023-09-18 22:00 kernel test robot
2023-09-18  8:14 [PATCH next v4 0/5] minmax: Relax type checks in min() and max() David Laight
2023-09-18  8:17 ` [PATCH next v4 2/5] minmax: Allow min()/max()/clamp() if the arguments have the same signedness David Laight

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.