oe-kbuild-all.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [dcui-tdx:decui/upstream-hyperv/hyperv-next/TDX/0810 13/25] drivers/hv/vmbus_drv.c:2002:33: warning: unsigned conversion from 'long long int' to 'resource_size_t' {aka 'unsigned int'} changes value from '68182605824' to '3758096384'
@ 2023-08-11  4:31 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-08-11  4:31 UTC (permalink / raw)
  To: Dexuan Cui; +Cc: oe-kbuild-all

tree:   https://github.com/dcui/tdx decui/upstream-hyperv/hyperv-next/TDX/0810
head:   104f836a5da361eec57916007c24e43c4d247951
commit: 02b4b7edb053ee20a72cc6962333e246d684a264 [13/25] Drivers: hv: vmbus:  Hardcode MMIO resources in vmbus_walk_resources() when necessary
config: i386-randconfig-i013-20230811 (https://download.01.org/0day-ci/archive/20230811/202308111201.fFOiPNDK-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230811/202308111201.fFOiPNDK-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/oe-kbuild-all/202308111201.fFOiPNDK-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/hv/vmbus_drv.c: In function 'vmbus_walk_resources':
>> drivers/hv/vmbus_drv.c:2002:33: warning: unsigned conversion from 'long long int' to 'resource_size_t' {aka 'unsigned int'} changes value from '68182605824' to '3758096384' [-Woverflow]
    2002 |                         start = 0xFE0000000;
         |                                 ^~~~~~~~~~~
   drivers/hv/vmbus_drv.c:2003:31: warning: unsigned conversion from 'long long int' to 'resource_size_t' {aka 'unsigned int'} changes value from '68719476735' to '4294967295' [-Woverflow]
    2003 |                         end = 0xFFFFFFFFF;
         |                               ^~~~~~~~~~~
   In file included from drivers/hv/vmbus_drv.c:40:
   arch/x86/include/asm/mshyperv.h: At top level:
   arch/x86/include/asm/mshyperv.h:249:12: warning: 'hv_snp_boot_ap' defined but not used [-Wunused-function]
     249 | static int hv_snp_boot_ap(int cpu, unsigned long start_ip) { return 0; }
         |            ^~~~~~~~~~~~~~


vim +2002 drivers/hv/vmbus_drv.c

  1965	
  1966	#ifdef CONFIG_ACPI
  1967	/*
  1968	 * VMBUS is an acpi enumerated device. Get the information we
  1969	 * need from DSDT.
  1970	 */
  1971	static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *ctx)
  1972	{
  1973		resource_size_t start = 0;
  1974		resource_size_t end = 0;
  1975		struct resource *new_res;
  1976		struct resource **old_res = &hyperv_mmio;
  1977		struct resource **prev_res = NULL;
  1978		struct resource r;
  1979	
  1980		switch (res->type) {
  1981	
  1982		/*
  1983		 * "Address" descriptors are for bus windows. Ignore
  1984		 * "memory" descriptors, which are for registers on
  1985		 * devices.
  1986		 */
  1987		case ACPI_RESOURCE_TYPE_ADDRESS32:
  1988			start = res->data.address32.address.minimum;
  1989			end = res->data.address32.address.maximum;
  1990			if (start == 0 && end == 0xFFFFFFFF) {
  1991				start = 0xF8000000;
  1992				end = 0xFFFFFFFF;
  1993				pr_warn("vmbus_walk_resources: using a default 32-bit MMIO range\n");
  1994			}
  1995			break;
  1996	
  1997		case ACPI_RESOURCE_TYPE_ADDRESS64:
  1998			start = res->data.address64.address.minimum;
  1999			end = res->data.address64.address.maximum;
  2000	
  2001			if (start == 0 && end == 0xFFFFFFFFFFFFFFFF) {
> 2002				start = 0xFE0000000;
  2003				end = 0xFFFFFFFFF;
  2004				pr_warn("vmbus_walk_resources: using a default 64-bit MMIO range\n");
  2005			}
  2006			break;
  2007	
  2008		/*
  2009		 * The IRQ information is needed only on ARM64, which Hyper-V
  2010		 * sets up in the extended format. IRQ information is present
  2011		 * on x86/x64 in the non-extended format but it is not used by
  2012		 * Linux. So don't bother checking for the non-extended format.
  2013		 */
  2014		case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
  2015			if (!acpi_dev_resource_interrupt(res, 0, &r)) {
  2016				pr_err("Unable to parse Hyper-V ACPI interrupt\n");
  2017				return AE_ERROR;
  2018			}
  2019			/* ARM64 INTID for VMbus */
  2020			vmbus_interrupt = res->data.extended_irq.interrupts[0];
  2021			/* Linux IRQ number */
  2022			vmbus_irq = r.start;
  2023			return AE_OK;
  2024	
  2025		default:
  2026			/* Unused resource type */
  2027			return AE_OK;
  2028	
  2029		}
  2030		/*
  2031		 * Ignore ranges that are below 1MB, as they're not
  2032		 * necessary or useful here.
  2033		 */
  2034		if (end < 0x100000)
  2035			return AE_OK;
  2036	
  2037		new_res = kzalloc(sizeof(*new_res), GFP_ATOMIC);
  2038		if (!new_res)
  2039			return AE_NO_MEMORY;
  2040	
  2041		/* If this range overlaps the virtual TPM, truncate it. */
  2042		if (end > VTPM_BASE_ADDRESS && start < VTPM_BASE_ADDRESS)
  2043			end = VTPM_BASE_ADDRESS;
  2044	
  2045		new_res->name = "hyperv mmio";
  2046		new_res->flags = IORESOURCE_MEM;
  2047		new_res->start = start;
  2048		new_res->end = end;
  2049	
  2050		/*
  2051		 * If two ranges are adjacent, merge them.
  2052		 */
  2053		do {
  2054			if (!*old_res) {
  2055				*old_res = new_res;
  2056				break;
  2057			}
  2058	
  2059			if (((*old_res)->end + 1) == new_res->start) {
  2060				(*old_res)->end = new_res->end;
  2061				kfree(new_res);
  2062				break;
  2063			}
  2064	
  2065			if ((*old_res)->start == new_res->end + 1) {
  2066				(*old_res)->start = new_res->start;
  2067				kfree(new_res);
  2068				break;
  2069			}
  2070	
  2071			if ((*old_res)->start > new_res->end) {
  2072				new_res->sibling = *old_res;
  2073				if (prev_res)
  2074					(*prev_res)->sibling = new_res;
  2075				*old_res = new_res;
  2076				break;
  2077			}
  2078	
  2079			prev_res = old_res;
  2080			old_res = &(*old_res)->sibling;
  2081	
  2082		} while (1);
  2083	
  2084		return AE_OK;
  2085	}
  2086	#endif
  2087	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-08-11  4:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-11  4:31 [dcui-tdx:decui/upstream-hyperv/hyperv-next/TDX/0810 13/25] drivers/hv/vmbus_drv.c:2002:33: warning: unsigned conversion from 'long long int' to 'resource_size_t' {aka 'unsigned int'} changes value from '68182605824' to '3758096384' kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).