From: kernel test robot <lkp@intel.com>
To: Alexander Usyskin <alexander.usyskin@intel.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Badal Nilawar <badal.nilawar@intel.com>
Subject: drivers/misc/mei/mei_lb.c:284:32: sparse: sparse: restricted __le32 degrades to integer
Date: Sat, 09 May 2026 15:59:00 +0800 [thread overview]
Message-ID: <202605091533.79Zcv3CX-lkp@intel.com> (raw)
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
next reply other threads:[~2026-05-09 7:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-09 7:59 kernel test robot [this message]
2026-05-10 10:13 ` drivers/misc/mei/mei_lb.c:284:32: sparse: sparse: restricted __le32 degrades to integer Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202605091533.79Zcv3CX-lkp@intel.com \
--to=lkp@intel.com \
--cc=alexander.usyskin@intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=badal.nilawar@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.