drivers/net/wwan/iosm/iosm_ipc_protocol_ops.c:416:4: warning: cast to pointer from integer of different size

From: kernel test robot
Date: Fri Jul 23 2021 - 05:50:26 EST


Hi Chetan,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8baef6386baaefb776bdd09b5c7630cf057c51c6
commit: f7af616c632ee2ac3af0876fe33bf9e0232e665a net: iosm: infrastructure
date: 6 weeks ago
config: i386-randconfig-m021-20210723 (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f7af616c632ee2ac3af0876fe33bf9e0232e665a
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout f7af616c632ee2ac3af0876fe33bf9e0232e665a
# save the attached .config to linux build tree
make W=1 ARCH=i386

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

All warnings (new ones prefixed by >>):

In file included from include/linux/device.h:15,
from include/linux/dma-mapping.h:7,
from include/linux/skbuff.h:31,
from drivers/net/wwan/iosm/iosm_ipc_imem.h:9,
from drivers/net/wwan/iosm/iosm_ipc_protocol.h:9,
from drivers/net/wwan/iosm/iosm_ipc_protocol_ops.c:6:
drivers/net/wwan/iosm/iosm_ipc_protocol_ops.c: In function 'ipc_protocol_dl_td_process':
>> drivers/net/wwan/iosm/iosm_ipc_protocol_ops.c:416:4: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
416 | (void *)p_td->buffer.address, skb->data);
| ^
include/linux/dev_printk.h:112:32: note: in definition of macro 'dev_err'
112 | _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~


vim +416 drivers/net/wwan/iosm/iosm_ipc_protocol_ops.c

64516f633bfd2f M Chetan Kumar 2021-06-13 370
64516f633bfd2f M Chetan Kumar 2021-06-13 371 /* Processes DL TD's */
64516f633bfd2f M Chetan Kumar 2021-06-13 372 struct sk_buff *ipc_protocol_dl_td_process(struct iosm_protocol *ipc_protocol,
64516f633bfd2f M Chetan Kumar 2021-06-13 373 struct ipc_pipe *pipe)
64516f633bfd2f M Chetan Kumar 2021-06-13 374 {
64516f633bfd2f M Chetan Kumar 2021-06-13 375 u32 tail =
64516f633bfd2f M Chetan Kumar 2021-06-13 376 le32_to_cpu(ipc_protocol->p_ap_shm->tail_array[pipe->pipe_nr]);
64516f633bfd2f M Chetan Kumar 2021-06-13 377 struct ipc_protocol_td *p_td;
64516f633bfd2f M Chetan Kumar 2021-06-13 378 struct sk_buff *skb;
64516f633bfd2f M Chetan Kumar 2021-06-13 379
64516f633bfd2f M Chetan Kumar 2021-06-13 380 if (!pipe->tdr_start)
64516f633bfd2f M Chetan Kumar 2021-06-13 381 return NULL;
64516f633bfd2f M Chetan Kumar 2021-06-13 382
64516f633bfd2f M Chetan Kumar 2021-06-13 383 /* Copy the reference to the downlink buffer. */
64516f633bfd2f M Chetan Kumar 2021-06-13 384 p_td = &pipe->tdr_start[pipe->old_tail];
64516f633bfd2f M Chetan Kumar 2021-06-13 385 skb = pipe->skbr_start[pipe->old_tail];
64516f633bfd2f M Chetan Kumar 2021-06-13 386
64516f633bfd2f M Chetan Kumar 2021-06-13 387 /* Reset the ring elements. */
64516f633bfd2f M Chetan Kumar 2021-06-13 388 pipe->skbr_start[pipe->old_tail] = NULL;
64516f633bfd2f M Chetan Kumar 2021-06-13 389
64516f633bfd2f M Chetan Kumar 2021-06-13 390 pipe->nr_of_queued_entries--;
64516f633bfd2f M Chetan Kumar 2021-06-13 391
64516f633bfd2f M Chetan Kumar 2021-06-13 392 pipe->old_tail++;
64516f633bfd2f M Chetan Kumar 2021-06-13 393 if (pipe->old_tail >= pipe->nr_of_entries)
64516f633bfd2f M Chetan Kumar 2021-06-13 394 pipe->old_tail = 0;
64516f633bfd2f M Chetan Kumar 2021-06-13 395
64516f633bfd2f M Chetan Kumar 2021-06-13 396 if (!skb) {
64516f633bfd2f M Chetan Kumar 2021-06-13 397 dev_err(ipc_protocol->dev, "skb is null");
64516f633bfd2f M Chetan Kumar 2021-06-13 398 goto ret;
64516f633bfd2f M Chetan Kumar 2021-06-13 399 } else if (!p_td->buffer.address) {
64516f633bfd2f M Chetan Kumar 2021-06-13 400 dev_err(ipc_protocol->dev, "td/buffer address is null");
64516f633bfd2f M Chetan Kumar 2021-06-13 401 ipc_pcie_kfree_skb(ipc_protocol->pcie, skb);
64516f633bfd2f M Chetan Kumar 2021-06-13 402 skb = NULL;
64516f633bfd2f M Chetan Kumar 2021-06-13 403 goto ret;
64516f633bfd2f M Chetan Kumar 2021-06-13 404 }
64516f633bfd2f M Chetan Kumar 2021-06-13 405
64516f633bfd2f M Chetan Kumar 2021-06-13 406 if (!IPC_CB(skb)) {
64516f633bfd2f M Chetan Kumar 2021-06-13 407 dev_err(ipc_protocol->dev, "pipe# %d, tail: %d skb_cb is NULL",
64516f633bfd2f M Chetan Kumar 2021-06-13 408 pipe->pipe_nr, tail);
64516f633bfd2f M Chetan Kumar 2021-06-13 409 ipc_pcie_kfree_skb(ipc_protocol->pcie, skb);
64516f633bfd2f M Chetan Kumar 2021-06-13 410 skb = NULL;
64516f633bfd2f M Chetan Kumar 2021-06-13 411 goto ret;
64516f633bfd2f M Chetan Kumar 2021-06-13 412 }
64516f633bfd2f M Chetan Kumar 2021-06-13 413
64516f633bfd2f M Chetan Kumar 2021-06-13 414 if (p_td->buffer.address != IPC_CB(skb)->mapping) {
64516f633bfd2f M Chetan Kumar 2021-06-13 415 dev_err(ipc_protocol->dev, "invalid buf=%p or skb=%p",
64516f633bfd2f M Chetan Kumar 2021-06-13 @416 (void *)p_td->buffer.address, skb->data);
64516f633bfd2f M Chetan Kumar 2021-06-13 417 ipc_pcie_kfree_skb(ipc_protocol->pcie, skb);
64516f633bfd2f M Chetan Kumar 2021-06-13 418 skb = NULL;
64516f633bfd2f M Chetan Kumar 2021-06-13 419 goto ret;
64516f633bfd2f M Chetan Kumar 2021-06-13 420 } else if ((le32_to_cpu(p_td->scs) & SIZE_MASK) > pipe->buf_size) {
64516f633bfd2f M Chetan Kumar 2021-06-13 421 dev_err(ipc_protocol->dev, "invalid buffer size %d > %d",
64516f633bfd2f M Chetan Kumar 2021-06-13 422 le32_to_cpu(p_td->scs) & SIZE_MASK,
64516f633bfd2f M Chetan Kumar 2021-06-13 423 pipe->buf_size);
64516f633bfd2f M Chetan Kumar 2021-06-13 424 ipc_pcie_kfree_skb(ipc_protocol->pcie, skb);
64516f633bfd2f M Chetan Kumar 2021-06-13 425 skb = NULL;
64516f633bfd2f M Chetan Kumar 2021-06-13 426 goto ret;
64516f633bfd2f M Chetan Kumar 2021-06-13 427 } else if (le32_to_cpu(p_td->scs) >> COMPLETION_STATUS ==
64516f633bfd2f M Chetan Kumar 2021-06-13 428 IPC_MEM_TD_CS_ABORT) {
64516f633bfd2f M Chetan Kumar 2021-06-13 429 /* Discard aborted buffers. */
64516f633bfd2f M Chetan Kumar 2021-06-13 430 dev_dbg(ipc_protocol->dev, "discard 'aborted' buffers");
64516f633bfd2f M Chetan Kumar 2021-06-13 431 ipc_pcie_kfree_skb(ipc_protocol->pcie, skb);
64516f633bfd2f M Chetan Kumar 2021-06-13 432 skb = NULL;
64516f633bfd2f M Chetan Kumar 2021-06-13 433 goto ret;
64516f633bfd2f M Chetan Kumar 2021-06-13 434 }
64516f633bfd2f M Chetan Kumar 2021-06-13 435
64516f633bfd2f M Chetan Kumar 2021-06-13 436 /* Set the length field in skbuf. */
64516f633bfd2f M Chetan Kumar 2021-06-13 437 skb_put(skb, le32_to_cpu(p_td->scs) & SIZE_MASK);
64516f633bfd2f M Chetan Kumar 2021-06-13 438
64516f633bfd2f M Chetan Kumar 2021-06-13 439 ret:
64516f633bfd2f M Chetan Kumar 2021-06-13 440 return skb;
64516f633bfd2f M Chetan Kumar 2021-06-13 441 }
64516f633bfd2f M Chetan Kumar 2021-06-13 442

:::::: The code at line 416 was first introduced by commit
:::::: 64516f633bfd2f576f3a18fe72184595367d11bf net: iosm: protocol operations

:::::: TO: M Chetan Kumar <m.chetan.kumar@xxxxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip