lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202312031832.x2ghPHYm-lkp@intel.com>
Date:   Sun, 3 Dec 2023 18:38:55 +0800
From:   kernel test robot <lkp@...el.com>
To:     Christophe Lombard <clombard@...ux.vnet.ibm.com>
Cc:     oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
        Michael Ellerman <mpe@...erman.id.au>,
        Frederic Barrat <fbarrat@...ux.vnet.ibm.com>,
        Manoj Kumar <manoj@...ux.vnet.ibm.com>
Subject: drivers/misc/cxl/guest.c:68:33: sparse: sparse: incorrect type in
 assignment (different base types)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   968f35f4ab1c0966ceb39af3c89f2e24afedf878
commit: 14baf4d9c739e6e69150512d2eb23c71fffcc192 cxl: Add guest-specific code
date:   8 years ago
config: powerpc64-randconfig-r113-20231107 (https://download.01.org/0day-ci/archive/20231203/202312031832.x2ghPHYm-lkp@intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231203/202312031832.x2ghPHYm-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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312031832.x2ghPHYm-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/misc/cxl/guest.c:68:33: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned long long [usertype] phys_addr @@     got restricted __be64 [usertype] @@
   drivers/misc/cxl/guest.c:68:33: sparse:     expected unsigned long long [usertype] phys_addr
   drivers/misc/cxl/guest.c:68:33: sparse:     got restricted __be64 [usertype]
>> drivers/misc/cxl/guest.c:69:27: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned long long [usertype] len @@     got restricted __be64 [usertype] @@
   drivers/misc/cxl/guest.c:69:27: sparse:     expected unsigned long long [usertype] len
   drivers/misc/cxl/guest.c:69:27: sparse:     got restricted __be64 [usertype]
   drivers/misc/cxl/guest.c:71:35: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned long long [usertype] len @@     got restricted __be64 [usertype] @@
   drivers/misc/cxl/guest.c:71:35: sparse:     expected unsigned long long [usertype] len
   drivers/misc/cxl/guest.c:71:35: sparse:     got restricted __be64 [usertype]
   drivers/misc/cxl/guest.c:363:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected unsigned short const volatile [noderef] [usertype] <asn:2> *addr @@     got unsigned short [usertype] * @@
   drivers/misc/cxl/guest.c:363:33: sparse:     expected unsigned short const volatile [noderef] [usertype] <asn:2> *addr
   drivers/misc/cxl/guest.c:363:33: sparse:     got unsigned short [usertype] *
   drivers/misc/cxl/guest.c:366:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected unsigned int const volatile [noderef] [usertype] <asn:2> *addr @@     got unsigned int * @@
   drivers/misc/cxl/guest.c:366:33: sparse:     expected unsigned int const volatile [noderef] [usertype] <asn:2> *addr
   drivers/misc/cxl/guest.c:366:33: sparse:     got unsigned int *
   drivers/misc/cxl/guest.c:369:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected unsigned long long const volatile [noderef] [usertype] <asn:2> *addr @@     got unsigned long long [usertype] * @@
   drivers/misc/cxl/guest.c:369:33: sparse:     expected unsigned long long const volatile [noderef] [usertype] <asn:2> *addr
   drivers/misc/cxl/guest.c:369:33: sparse:     got unsigned long long [usertype] *
>> drivers/misc/cxl/guest.c:439:23: sparse: sparse: invalid assignment: |=
>> drivers/misc/cxl/guest.c:439:23: sparse:    left side has type restricted __be64
>> drivers/misc/cxl/guest.c:439:23: sparse:    right side has type unsigned long long
   drivers/misc/cxl/guest.c:440:23: sparse: sparse: invalid assignment: |=
   drivers/misc/cxl/guest.c:440:23: sparse:    left side has type restricted __be64
   drivers/misc/cxl/guest.c:440:23: sparse:    right side has type unsigned long long
   drivers/misc/cxl/guest.c:442:31: sparse: sparse: invalid assignment: |=
   drivers/misc/cxl/guest.c:442:31: sparse:    left side has type restricted __be64
   drivers/misc/cxl/guest.c:442:31: sparse:    right side has type unsigned long long
   drivers/misc/cxl/guest.c:445:23: sparse: sparse: invalid assignment: |=
   drivers/misc/cxl/guest.c:445:23: sparse:    left side has type restricted __be64
   drivers/misc/cxl/guest.c:445:23: sparse:    right side has type unsigned long long
   drivers/misc/cxl/guest.c:446:23: sparse: sparse: invalid assignment: |=
   drivers/misc/cxl/guest.c:446:23: sparse:    left side has type restricted __be64
   drivers/misc/cxl/guest.c:446:23: sparse:    right side has type unsigned long long
   drivers/misc/cxl/guest.c:448:31: sparse: sparse: invalid assignment: |=
   drivers/misc/cxl/guest.c:448:31: sparse:    left side has type restricted __be64
   drivers/misc/cxl/guest.c:448:31: sparse:    right side has type unsigned long long
   drivers/misc/cxl/guest.c:451:31: sparse: sparse: invalid assignment: |=
   drivers/misc/cxl/guest.c:451:31: sparse:    left side has type restricted __be64
   drivers/misc/cxl/guest.c:451:31: sparse:    right side has type unsigned long long
>> drivers/misc/cxl/guest.c:454:31: sparse: sparse: cast from restricted __be64
   drivers/misc/cxl/guest.c:454:31: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned long long [usertype] val @@     got restricted __be64 [usertype] flags @@
   drivers/misc/cxl/guest.c:454:31: sparse:     expected unsigned long long [usertype] val
   drivers/misc/cxl/guest.c:454:31: sparse:     got restricted __be64 [usertype] flags
>> drivers/misc/cxl/guest.c:454:31: sparse: sparse: cast from restricted __be64
>> drivers/misc/cxl/guest.c:454:31: sparse: sparse: cast from restricted __be64
>> drivers/misc/cxl/guest.c:454:31: sparse: sparse: cast from restricted __be64
>> drivers/misc/cxl/guest.c:454:31: sparse: sparse: cast from restricted __be64
>> drivers/misc/cxl/guest.c:454:31: sparse: sparse: cast from restricted __be64
>> drivers/misc/cxl/guest.c:454:31: sparse: sparse: cast from restricted __be64
>> drivers/misc/cxl/guest.c:454:31: sparse: sparse: cast from restricted __be64
>> drivers/misc/cxl/guest.c:454:31: sparse: sparse: cast from restricted __be64
   drivers/misc/cxl/guest.c: In function 'afu_properties_look_ok':
   drivers/misc/cxl/guest.c:708:26: warning: comparison of unsigned expression in '< 0' is always false [-Wtype-limits]
     708 |         if (afu->crs_len < 0) {
         |                          ^

vim +68 drivers/misc/cxl/guest.c

    27	
    28	static ssize_t guest_collect_vpd(struct cxl *adapter, struct cxl_afu *afu,
    29				void *buf, size_t len)
    30	{
    31		unsigned int entries, mod;
    32		unsigned long **vpd_buf = NULL;
    33		struct sg_list *le;
    34		int rc = 0, i, tocopy;
    35		u64 out = 0;
    36	
    37		if (buf == NULL)
    38			return -EINVAL;
    39	
    40		/* number of entries in the list */
    41		entries = len / SG_BUFFER_SIZE;
    42		mod = len % SG_BUFFER_SIZE;
    43		if (mod)
    44			entries++;
    45	
    46		if (entries > SG_MAX_ENTRIES) {
    47			entries = SG_MAX_ENTRIES;
    48			len = SG_MAX_ENTRIES * SG_BUFFER_SIZE;
    49			mod = 0;
    50		}
    51	
    52		vpd_buf = kzalloc(entries * sizeof(unsigned long *), GFP_KERNEL);
    53		if (!vpd_buf)
    54			return -ENOMEM;
    55	
    56		le = (struct sg_list *)get_zeroed_page(GFP_KERNEL);
    57		if (!le) {
    58			rc = -ENOMEM;
    59			goto err1;
    60		}
    61	
    62		for (i = 0; i < entries; i++) {
    63			vpd_buf[i] = (unsigned long *)get_zeroed_page(GFP_KERNEL);
    64			if (!vpd_buf[i]) {
    65				rc = -ENOMEM;
    66				goto err2;
    67			}
  > 68			le[i].phys_addr = cpu_to_be64(virt_to_phys(vpd_buf[i]));
  > 69			le[i].len = cpu_to_be64(SG_BUFFER_SIZE);
    70			if ((i == (entries - 1)) && mod)
    71				le[i].len = cpu_to_be64(mod);
    72		}
    73	
    74		if (adapter)
    75			rc = cxl_h_collect_vpd_adapter(adapter->guest->handle,
    76						virt_to_phys(le), entries, &out);
    77		else
    78			rc = cxl_h_collect_vpd(afu->guest->handle, 0,
    79					virt_to_phys(le), entries, &out);
    80		pr_devel("length of available (entries: %i), vpd: %#llx\n",
    81			entries, out);
    82	
    83		if (!rc) {
    84			/*
    85			 * hcall returns in 'out' the size of available VPDs.
    86			 * It fills the buffer with as much data as possible.
    87			 */
    88			if (out < len)
    89				len = out;
    90			rc = len;
    91			if (out) {
    92				for (i = 0; i < entries; i++) {
    93					if (len < SG_BUFFER_SIZE)
    94						tocopy = len;
    95					else
    96						tocopy = SG_BUFFER_SIZE;
    97					memcpy(buf, vpd_buf[i], tocopy);
    98					buf += tocopy;
    99					len -= tocopy;
   100				}
   101			}
   102		}
   103	err2:
   104		for (i = 0; i < entries; i++) {
   105			if (vpd_buf[i])
   106				free_page((unsigned long) vpd_buf[i]);
   107		}
   108		free_page((unsigned long) le);
   109	err1:
   110		kfree(vpd_buf);
   111		return rc;
   112	}
   113	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ