drivers/net/ethernet/google/gve/gve_rx_dqo.c:570:11: warning: cast to pointer from integer of different size

From: kernel test robot
Date: Thu Jul 01 2021 - 17:13:01 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: e058a84bfddc42ba356a2316f2cf1141974625c9
commit: 9b8dd5e5ea48bbb7532d20c4093a79d8283e4029 gve: DQO: Add RX path
date: 7 days ago
config: i386-randconfig-a001-20210702 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9b8dd5e5ea48bbb7532d20c4093a79d8283e4029
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 9b8dd5e5ea48bbb7532d20c4093a79d8283e4029
# 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 >>):

drivers/net/ethernet/google/gve/gve_rx_dqo.c: In function 'gve_rx_dqo':
>> drivers/net/ethernet/google/gve/gve_rx_dqo.c:570:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
570 | prefetch((char *)buf_state->addr + buf_state->page_info.page_offset);
| ^
drivers/net/ethernet/google/gve/gve_rx_dqo.c:572:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
572 | prefetch((char *)buf_state->addr + buf_state->page_info.page_offset +
| ^


vim +570 drivers/net/ethernet/google/gve/gve_rx_dqo.c

513
514 /* Returns 0 if descriptor is completed successfully.
515 * Returns -EINVAL if descriptor is invalid.
516 * Returns -ENOMEM if data cannot be copied to skb.
517 */
518 static int gve_rx_dqo(struct napi_struct *napi, struct gve_rx_ring *rx,
519 const struct gve_rx_compl_desc_dqo *compl_desc,
520 int queue_idx)
521 {
522 const u16 buffer_id = le16_to_cpu(compl_desc->buf_id);
523 const bool eop = compl_desc->end_of_packet != 0;
524 struct gve_rx_buf_state_dqo *buf_state;
525 struct gve_priv *priv = rx->gve;
526 u16 buf_len;
527
528 if (unlikely(buffer_id > rx->dqo.num_buf_states)) {
529 net_err_ratelimited("%s: Invalid RX buffer_id=%u\n",
530 priv->dev->name, buffer_id);
531 return -EINVAL;
532 }
533 buf_state = &rx->dqo.buf_states[buffer_id];
534 if (unlikely(!gve_buf_state_is_allocated(rx, buf_state))) {
535 net_err_ratelimited("%s: RX buffer_id is not allocated: %u\n",
536 priv->dev->name, buffer_id);
537 return -EINVAL;
538 }
539
540 if (unlikely(compl_desc->rx_error)) {
541 gve_enqueue_buf_state(rx, &rx->dqo.recycled_buf_states,
542 buf_state);
543 return -EINVAL;
544 }
545
546 buf_len = compl_desc->packet_len;
547
548 /* Page might have not been used for awhile and was likely last written
549 * by a different thread.
550 */
551 prefetch(buf_state->page_info.page);
552
553 /* Sync the portion of dma buffer for CPU to read. */
554 dma_sync_single_range_for_cpu(&priv->pdev->dev, buf_state->addr,
555 buf_state->page_info.page_offset,
556 buf_len, DMA_FROM_DEVICE);
557
558 /* Append to current skb if one exists. */
559 if (rx->skb_head) {
560 if (unlikely(gve_rx_append_frags(napi, buf_state, buf_len, rx,
561 priv)) != 0) {
562 goto error;
563 }
564
565 gve_try_recycle_buf(priv, rx, buf_state);
566 return 0;
567 }
568
569 /* Prefetch the payload header. */
> 570 prefetch((char *)buf_state->addr + buf_state->page_info.page_offset);
571 #if L1_CACHE_BYTES < 128
572 prefetch((char *)buf_state->addr + buf_state->page_info.page_offset +
573 L1_CACHE_BYTES);
574 #endif
575
576 if (eop && buf_len <= priv->rx_copybreak) {
577 rx->skb_head = gve_rx_copy(priv->dev, napi,
578 &buf_state->page_info, buf_len, 0);
579 if (unlikely(!rx->skb_head))
580 goto error;
581 rx->skb_tail = rx->skb_head;
582
583 u64_stats_update_begin(&rx->statss);
584 rx->rx_copied_pkt++;
585 rx->rx_copybreak_pkt++;
586 u64_stats_update_end(&rx->statss);
587
588 gve_enqueue_buf_state(rx, &rx->dqo.recycled_buf_states,
589 buf_state);
590 return 0;
591 }
592
593 rx->skb_head = napi_get_frags(napi);
594 if (unlikely(!rx->skb_head))
595 goto error;
596 rx->skb_tail = rx->skb_head;
597
598 skb_add_rx_frag(rx->skb_head, 0, buf_state->page_info.page,
599 buf_state->page_info.page_offset, buf_len,
600 priv->data_buffer_size_dqo);
601 gve_dec_pagecnt_bias(&buf_state->page_info);
602
603 gve_try_recycle_buf(priv, rx, buf_state);
604 return 0;
605
606 error:
607 gve_enqueue_buf_state(rx, &rx->dqo.recycled_buf_states, buf_state);
608 return -ENOMEM;
609 }
610

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

Attachment: .config.gz
Description: application/gzip