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: <202111122100.y3zX0JbR-lkp@intel.com>
Date:   Fri, 12 Nov 2021 21:28:10 +0800
From:   kernel test robot <lkp@...el.com>
To:     Cristian Marussi <cristian.marussi@....com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Sudeep Holla <sudeep.holla@....com>
Subject: drivers/firmware/arm_scmi/voltage.c:159:42: sparse: sparse:
 incorrect type in assignment (different base types)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   5833291ab6de9c3e2374336b51c814e515e8f3a5
commit: 2add5cacff3531e54c50b0832128299faa9f0563 firmware: arm_scmi: Add voltage domain management protocol support
date:   12 months ago
config: riscv-randconfig-s032-20211109 (attached as .config)
compiler: riscv32-linux-gcc (GCC) 11.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2add5cacff3531e54c50b0832128299faa9f0563
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 2add5cacff3531e54c50b0832128299faa9f0563
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>


sparse warnings: (new ones prefixed by >>)
>> drivers/firmware/arm_scmi/voltage.c:159:42: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [usertype] level_index @@     got unsigned int [usertype] desc_index @@
   drivers/firmware/arm_scmi/voltage.c:159:42: sparse:     expected restricted __le32 [usertype] level_index
   drivers/firmware/arm_scmi/voltage.c:159:42: sparse:     got unsigned int [usertype] desc_index

vim +159 drivers/firmware/arm_scmi/voltage.c

   111	
   112	static int scmi_voltage_descriptors_get(const struct scmi_handle *handle,
   113						struct voltage_info *vinfo)
   114	{
   115		int ret, dom;
   116		struct scmi_xfer *td, *tl;
   117		struct device *dev = handle->dev;
   118		struct scmi_msg_resp_domain_attributes *resp_dom;
   119		struct scmi_msg_resp_describe_levels *resp_levels;
   120	
   121		ret = scmi_xfer_get_init(handle, VOLTAGE_DOMAIN_ATTRIBUTES,
   122					 SCMI_PROTOCOL_VOLTAGE, sizeof(__le32),
   123					 sizeof(*resp_dom), &td);
   124		if (ret)
   125			return ret;
   126		resp_dom = td->rx.buf;
   127	
   128		ret = scmi_xfer_get_init(handle, VOLTAGE_DESCRIBE_LEVELS,
   129					 SCMI_PROTOCOL_VOLTAGE, sizeof(__le64), 0, &tl);
   130		if (ret)
   131			goto outd;
   132		resp_levels = tl->rx.buf;
   133	
   134		for (dom = 0; dom < vinfo->num_domains; dom++) {
   135			u32 desc_index = 0;
   136			u16 num_returned = 0, num_remaining = 0;
   137			struct scmi_msg_cmd_describe_levels *cmd;
   138			struct scmi_voltage_info *v;
   139	
   140			/* Retrieve domain attributes at first ... */
   141			put_unaligned_le32(dom, td->tx.buf);
   142			ret = scmi_do_xfer(handle, td);
   143			/* Skip domain on comms error */
   144			if (ret)
   145				continue;
   146	
   147			v = vinfo->domains + dom;
   148			v->id = dom;
   149			v->attributes = le32_to_cpu(resp_dom->attr);
   150			strlcpy(v->name, resp_dom->name, SCMI_MAX_STR_SIZE);
   151	
   152			cmd = tl->tx.buf;
   153			/* ...then retrieve domain levels descriptions */
   154			do {
   155				u32 flags;
   156				int cnt;
   157	
   158				cmd->domain_id = cpu_to_le32(v->id);
 > 159				cmd->level_index = desc_index;
   160				ret = scmi_do_xfer(handle, tl);
   161				if (ret)
   162					break;
   163	
   164				flags = le32_to_cpu(resp_levels->flags);
   165				num_returned = NUM_RETURNED_LEVELS(flags);
   166				num_remaining = NUM_REMAINING_LEVELS(flags);
   167	
   168				/* Allocate space for num_levels if not already done */
   169				if (!v->num_levels) {
   170					ret = scmi_init_voltage_levels(dev, v,
   171								       num_returned,
   172								       num_remaining,
   173						      SUPPORTS_SEGMENTED_LEVELS(flags));
   174					if (ret)
   175						break;
   176				}
   177	
   178				if (desc_index + num_returned > v->num_levels) {
   179					dev_err(handle->dev,
   180						"No. of voltage levels can't exceed %d\n",
   181						v->num_levels);
   182					ret = -EINVAL;
   183					break;
   184				}
   185	
   186				for (cnt = 0; cnt < num_returned; cnt++) {
   187					s32 val;
   188	
   189					val =
   190					    (s32)le32_to_cpu(resp_levels->voltage[cnt]);
   191					v->levels_uv[desc_index + cnt] = val;
   192					if (val < 0)
   193						v->negative_volts_allowed = true;
   194				}
   195	
   196				desc_index += num_returned;
   197	
   198				scmi_reset_rx_to_maxsz(handle, tl);
   199				/* check both to avoid infinite loop due to buggy fw */
   200			} while (num_returned && num_remaining);
   201	
   202			if (ret) {
   203				v->num_levels = 0;
   204				devm_kfree(dev, v->levels_uv);
   205			}
   206	
   207			scmi_reset_rx_to_maxsz(handle, td);
   208		}
   209	
   210		scmi_xfer_put(handle, tl);
   211	outd:
   212		scmi_xfer_put(handle, td);
   213	
   214		return ret;
   215	}
   216	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (34060 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ