Messages in this thread |  | | Date | Sun, 23 May 2021 02:08:01 +0800 | From | kernel test robot <> | Subject | drivers/net/vmxnet3/vmxnet3_drv.c:607:21: warning: result of comparison of constant 262144 with expression of type 'u16' (aka 'unsigned short') is always true |
| |
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 45af60e7ced07ae3def41368c3d260dbf496fbce commit: 4eeef098b43242ed145c83fba9989d586d707589 powerpc/44x: Remove STDBINUTILS kconfig option date: 4 months ago config: powerpc-randconfig-r021-20210522 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project e84a9b9bb3051c35dea993cdad7b3d2575638f85) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install powerpc cross compiling tool for clang build # apt-get install binutils-powerpc-linux-gnu # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4eeef098b43242ed145c83fba9989d586d707589 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 4eeef098b43242ed145c83fba9989d586d707589 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc
If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/net/vmxnet3/vmxnet3_drv.c:607:21: warning: result of comparison of constant 262144 with expression of type 'u16' (aka 'unsigned short') is always true [-Wtautological-constant-out-of-range-compare] rbi->len != PAGE_SIZE); ~~~~~~~~~~^~~~~~~~~~~~~ arch/powerpc/include/asm/bug.h:73:27: note: expanded from macro 'BUG_ON' if (__builtin_constant_p(x)) { \ ^ >> drivers/net/vmxnet3/vmxnet3_drv.c:607:21: warning: result of comparison of constant 262144 with expression of type 'u16' (aka 'unsigned short') is always true [-Wtautological-constant-out-of-range-compare] rbi->len != PAGE_SIZE); ~~~~~~~~~~^~~~~~~~~~~~~ arch/powerpc/include/asm/bug.h:74:7: note: expanded from macro 'BUG_ON' if (x) \ ^ >> drivers/net/vmxnet3/vmxnet3_drv.c:1784:29: warning: implicit conversion from 'unsigned long' to 'u16' (aka 'unsigned short') changes value from 262144 to 0 [-Wconstant-conversion] rq->buf_info[0][i].len = PAGE_SIZE; ~ ^~~~~~~~~ arch/powerpc/include/asm/page.h:24:34: note: expanded from macro 'PAGE_SIZE' #define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT) ~~~~~~~~~~~~~^~~~~~~~~~~~~ drivers/net/vmxnet3/vmxnet3_drv.c:1789:28: warning: implicit conversion from 'unsigned long' to 'u16' (aka 'unsigned short') changes value from 262144 to 0 [-Wconstant-conversion] rq->buf_info[1][i].len = PAGE_SIZE; ~ ^~~~~~~~~ arch/powerpc/include/asm/page.h:24:34: note: expanded from macro 'PAGE_SIZE' #define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT) ~~~~~~~~~~~~~^~~~~~~~~~~~~ 4 warnings generated. -- >> net/bluetooth/hci_core.c:2108:26: warning: result of comparison of constant 65536 with expression of type '__u16' (aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare] if (!dev_num || dev_num > (PAGE_SIZE * 2) / sizeof(*dr)) ~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated.
vim +607 drivers/net/vmxnet3/vmxnet3_drv.c
d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 558 d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 559 /* d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 560 * starting from ring->next2fill, allocate rx buffers for the given ring d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 561 * of the rx queue and update the rx desc. stop after @num_to_alloc buffers d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 562 * are allocated or allocation fails d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 563 */ d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 564 d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 565 static int d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 566 vmxnet3_rq_alloc_rx_buf(struct vmxnet3_rx_queue *rq, u32 ring_idx, d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 567 int num_to_alloc, struct vmxnet3_adapter *adapter) d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 568 { d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 569 int num_allocated = 0; d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 570 struct vmxnet3_rx_buf_info *rbi_base = rq->buf_info[ring_idx]; d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 571 struct vmxnet3_cmd_ring *ring = &rq->rx_ring[ring_idx]; d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 572 u32 val; d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 573 5318d809d7b4975 Shreyas Bhatewara 2011-07-05 574 while (num_allocated <= num_to_alloc) { d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 575 struct vmxnet3_rx_buf_info *rbi; d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 576 union Vmxnet3_GenericDesc *gd; d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 577 d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 578 rbi = rbi_base + ring->next2fill; d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 579 gd = ring->base + ring->next2fill; d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 580 d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 581 if (rbi->buf_type == VMXNET3_RX_BUF_SKB) { d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 582 if (rbi->skb == NULL) { 0d735f13d8842d9 Stephen Hemminger 2013-01-15 583 rbi->skb = __netdev_alloc_skb_ip_align(adapter->netdev, 0d735f13d8842d9 Stephen Hemminger 2013-01-15 584 rbi->len, 0d735f13d8842d9 Stephen Hemminger 2013-01-15 585 GFP_KERNEL); d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 586 if (unlikely(rbi->skb == NULL)) { d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 587 rq->stats.rx_buf_alloc_failure++; d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 588 break; d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 589 } d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 590 b0eb57cb97e7837 Andy King 2013-08-23 591 rbi->dma_addr = dma_map_single( b0eb57cb97e7837 Andy King 2013-08-23 592 &adapter->pdev->dev, d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 593 rbi->skb->data, rbi->len, d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 594 PCI_DMA_FROMDEVICE); 5738a09d58d5ad2 Alexey Khoroshilov 2015-11-28 595 if (dma_mapping_error(&adapter->pdev->dev, 5738a09d58d5ad2 Alexey Khoroshilov 2015-11-28 596 rbi->dma_addr)) { 5738a09d58d5ad2 Alexey Khoroshilov 2015-11-28 597 dev_kfree_skb_any(rbi->skb); 5738a09d58d5ad2 Alexey Khoroshilov 2015-11-28 598 rq->stats.rx_buf_alloc_failure++; 5738a09d58d5ad2 Alexey Khoroshilov 2015-11-28 599 break; 5738a09d58d5ad2 Alexey Khoroshilov 2015-11-28 600 } d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 601 } else { d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 602 /* rx buffer skipped by the device */ d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 603 } d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 604 val = VMXNET3_RXD_BTYPE_HEAD << VMXNET3_RXD_BTYPE_SHIFT; d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 605 } else { d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 606 BUG_ON(rbi->buf_type != VMXNET3_RX_BUF_PAGE || d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 @607 rbi->len != PAGE_SIZE); d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 608 d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 609 if (rbi->page == NULL) { d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 610 rbi->page = alloc_page(GFP_ATOMIC); d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 611 if (unlikely(rbi->page == NULL)) { d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 612 rq->stats.rx_buf_alloc_failure++; d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 613 break; d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 614 } b0eb57cb97e7837 Andy King 2013-08-23 615 rbi->dma_addr = dma_map_page( b0eb57cb97e7837 Andy King 2013-08-23 616 &adapter->pdev->dev, d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 617 rbi->page, 0, PAGE_SIZE, d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 618 PCI_DMA_FROMDEVICE); 5738a09d58d5ad2 Alexey Khoroshilov 2015-11-28 619 if (dma_mapping_error(&adapter->pdev->dev, 5738a09d58d5ad2 Alexey Khoroshilov 2015-11-28 620 rbi->dma_addr)) { 5738a09d58d5ad2 Alexey Khoroshilov 2015-11-28 621 put_page(rbi->page); 5738a09d58d5ad2 Alexey Khoroshilov 2015-11-28 622 rq->stats.rx_buf_alloc_failure++; 5738a09d58d5ad2 Alexey Khoroshilov 2015-11-28 623 break; 5738a09d58d5ad2 Alexey Khoroshilov 2015-11-28 624 } d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 625 } else { d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 626 /* rx buffers skipped by the device */ d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 627 } d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 628 val = VMXNET3_RXD_BTYPE_BODY << VMXNET3_RXD_BTYPE_SHIFT; d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 629 } d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 630 115924b6bdc7cc6 Shreyas Bhatewara 2009-11-16 631 gd->rxd.addr = cpu_to_le64(rbi->dma_addr); 5318d809d7b4975 Shreyas Bhatewara 2011-07-05 632 gd->dword[2] = cpu_to_le32((!ring->gen << VMXNET3_RXD_GEN_SHIFT) 115924b6bdc7cc6 Shreyas Bhatewara 2009-11-16 633 | val | rbi->len); d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 634 5318d809d7b4975 Shreyas Bhatewara 2011-07-05 635 /* Fill the last buffer but dont mark it ready, or else the 5318d809d7b4975 Shreyas Bhatewara 2011-07-05 636 * device will think that the queue is full */ 5318d809d7b4975 Shreyas Bhatewara 2011-07-05 637 if (num_allocated == num_to_alloc) 5318d809d7b4975 Shreyas Bhatewara 2011-07-05 638 break; 5318d809d7b4975 Shreyas Bhatewara 2011-07-05 639 5318d809d7b4975 Shreyas Bhatewara 2011-07-05 640 gd->dword[2] |= cpu_to_le32(ring->gen << VMXNET3_RXD_GEN_SHIFT); d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 641 num_allocated++; d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 642 vmxnet3_cmd_ring_adv_next2fill(ring); d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 643 } d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 644 fdcd79b94b24418 Stephen Hemminger 2013-01-15 645 netdev_dbg(adapter->netdev, 69b9a712661cbd4 Stephen Hemminger 2013-01-15 646 "alloc_rx_buf: %d allocated, next2fill %u, next2comp %u\n", 69b9a712661cbd4 Stephen Hemminger 2013-01-15 647 num_allocated, ring->next2fill, ring->next2comp); d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 648 d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 649 /* so that the device can distinguish a full ring and an empty ring */ d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 650 BUG_ON(num_allocated != 0 && ring->next2fill == ring->next2comp); d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 651 d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 652 return num_allocated; d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 653 } d1a890fa37f27d6 Shreyas Bhatewara 2009-10-13 654
:::::: The code at line 607 was first introduced by commit :::::: d1a890fa37f27d6aca3abc6e25e4148efc3223a6 net: VMware virtual Ethernet NIC driver: vmxnet3
:::::: TO: Shreyas Bhatewara <sbhatewara@vmware.com> :::::: CC: David S. Miller <davem@davemloft.net>
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org [unhandled content-type:application/gzip] |  |