The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* drivers/misc/mei/mei_lb.c:284:32: sparse: sparse: restricted __le32 degrades to integer
@ 2026-05-09  7:59 kernel test robot
  2026-05-10 10:13 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2026-05-09  7:59 UTC (permalink / raw)
  To: Alexander Usyskin
  Cc: oe-kbuild-all, linux-kernel, Andy Shevchenko, Badal Nilawar

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   70390501d1944d4e5b8f7352be180fceb3a44132
commit: 773a43b8627f54dca56d08949497014b4ee8878a mei: lb: add late binding version 2
date:   5 weeks ago
config: mips-randconfig-r134-20260508 (https://download.01.org/0day-ci/archive/20260509/202605091533.79Zcv3CX-lkp@intel.com/config)
compiler: mips-linux-gcc (GCC) 8.5.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260509/202605091533.79Zcv3CX-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
| Fixes: 773a43b8627f ("mei: lb: add late binding version 2")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605091533.79Zcv3CX-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/misc/mei/mei_lb.c:284:32: sparse: sparse: restricted __le32 degrades to integer
>> drivers/misc/mei/mei_lb.c:330:40: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [usertype] command_id @@     got int @@
   drivers/misc/mei/mei_lb.c:330:40: sparse:     expected restricted __le32 [usertype] command_id
   drivers/misc/mei/mei_lb.c:330:40: sparse:     got int

vim +284 drivers/misc/mei/mei_lb.c

   269	
   270	static int mei_lb_check_response_v2(const struct device *dev, ssize_t bytes,
   271					    struct mei_lb2_rsp *rsp)
   272	{
   273		/*
   274		 * Received message size may be smaller than the full message size when
   275		 * reply contains only header with status field set to the error code.
   276		 * Check the header size and content first to output exact error, if needed,
   277		 * and then process to the whole message.
   278		 */
   279		if (bytes < sizeof(rsp->rheader)) {
   280			dev_err(dev, "Received less than header size from the firmware: %zd < %zu\n",
   281				bytes, sizeof(rsp->rheader));
   282			return -ENOMSG;
   283		}
 > 284		if (rsp->rheader.header.command_id != MEI_LB2_CMD) {
   285			dev_err(dev, "Mismatch command: 0x%x instead of 0x%x\n",
   286				rsp->rheader.header.command_id, MEI_LB2_CMD);
   287			return -EPROTO;
   288		}
   289		if (!(rsp->rheader.header.flags & MEI_LB2_HDR_FLAG_RSP)) {
   290			dev_err(dev, "Not a response: 0x%x\n", rsp->rheader.header.flags);
   291			return -EBADMSG;
   292		}
   293		if (rsp->rheader.status) {
   294			dev_err(dev, "Error in result: 0x%x\n", rsp->rheader.status);
   295			return (int)le32_to_cpu(rsp->rheader.status);
   296		}
   297		if (bytes < sizeof(*rsp)) {
   298			dev_err(dev, "Received less than message size from the firmware: %zd < %zu\n",
   299				bytes, sizeof(*rsp));
   300			return -ENODATA;
   301		}
   302	
   303		return 0;
   304	}
   305	
   306	static int mei_lb_push_payload_v2(struct device *dev, struct mei_cl_device *cldev,
   307					  u32 type, u32 flags, const void *payload, size_t payload_size)
   308	{
   309		u32 first_chunk, last_chunk;
   310		struct mei_lb2_rsp rsp;
   311		size_t sent_data = 0;
   312		size_t chunk_size;
   313		size_t req_size;
   314		ssize_t bytes;
   315		int ret;
   316	
   317		struct mei_lb2_req *req __free(kfree) = kzalloc(mei_cldev_mtu(cldev), GFP_KERNEL);
   318		if (!req)
   319			return -ENOMEM;
   320	
   321		first_chunk = MEI_LB2_FLAG_FST_CHUNK;
   322		last_chunk = 0;
   323		do {
   324			chunk_size = min(payload_size - sent_data, mei_cldev_mtu(cldev) - sizeof(*req));
   325	
   326			req_size = struct_size(req, payload, chunk_size);
   327			if (sent_data + chunk_size == payload_size)
   328				last_chunk = MEI_LB2_FLAG_LST_CHUNK;
   329	
 > 330			req->header.command_id = MEI_LB2_CMD;
   331			req->type = cpu_to_le32(type);
   332			req->flags = cpu_to_le32(flags | first_chunk | last_chunk);
   333			req->reserved = 0;
   334			req->total_payload_size = cpu_to_le32(payload_size);
   335			req->payload_size = cpu_to_le32(chunk_size);
   336			memcpy(req->payload, payload + sent_data, chunk_size);
   337	
   338			dev_dbg(dev, "Sending %zu bytes from offset %zu of %zu%s%s\n",
   339				chunk_size, sent_data, payload_size,
   340				first_chunk ? " first" : "", last_chunk ? " last" : "");
   341	
   342			bytes = mei_cldev_send_timeout(cldev, (u8 *)req, req_size,
   343						       INTEL_LB_SEND_TIMEOUT_MSEC);
   344			if (bytes < 0) {
   345				dev_err(dev, "Failed to send late binding request to firmware. %zd\n",
   346					bytes);
   347				return bytes;
   348			}
   349	
   350			bytes = mei_cldev_recv_timeout(cldev, (u8 *)&rsp, sizeof(rsp),
   351						       INTEL_LB_RECV_TIMEOUT_MSEC);
   352			if (bytes < 0) {
   353				dev_err(dev, "Failed to receive late binding reply from firmware. %zd\n",
   354					bytes);
   355				return bytes;
   356			}
   357			ret = mei_lb_check_response_v2(dev, bytes, &rsp);
   358			if (ret)
   359				return ret;
   360	
   361			/* prepare for the next chunk */
   362			sent_data += chunk_size;
   363			first_chunk = 0;
   364		} while (!last_chunk);
   365	
   366		return 0;
   367	}
   368	

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

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

end of thread, other threads:[~2026-05-10 10:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-09  7:59 drivers/misc/mei/mei_lb.c:284:32: sparse: sparse: restricted __le32 degrades to integer kernel test robot
2026-05-10 10:13 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox