drivers//virtio/virtio_balloon.c:594:22: note: in expansion of macro 'VIRTIO_BALLOON_HINT_BLOCK_BYTES'

From: kbuild test robot
Date: Wed Dec 25 2019 - 22:06:14 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 46cf053efec6a3a5f343fead837777efe8252a46
commit: 2a946fa1c8bc26df03bacebb6811b656d5e0cf1c virtio_balloon: name cleanups
date: 2 weeks ago
config: ia64-randconfig-a001-20191226 (attached as .config)
compiler: ia64-linux-gcc (GCC) 7.5.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 2a946fa1c8bc26df03bacebb6811b656d5e0cf1c
# save the attached .config to linux build tree
GCC_VERSION=7.5.0 make.cross ARCH=ia64

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

All warnings (new ones prefixed by >>):

drivers//virtio/virtio_balloon.c: In function 'get_free_page_and_send':
drivers//virtio/virtio_balloon.c:38:5: warning: left shift count >= width of type [-Wshift-count-overflow]
(1 << (VIRTIO_BALLOON_HINT_BLOCK_ORDER + PAGE_SHIFT))
^
>> drivers//virtio/virtio_balloon.c:594:22: note: in expansion of macro 'VIRTIO_BALLOON_HINT_BLOCK_BYTES'
sg_init_one(&sg, p, VIRTIO_BALLOON_HINT_BLOCK_BYTES);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/VIRTIO_BALLOON_HINT_BLOCK_BYTES +594 drivers//virtio/virtio_balloon.c

571
572 static int get_free_page_and_send(struct virtio_balloon *vb)
573 {
574 struct virtqueue *vq = vb->free_page_vq;
575 struct page *page;
576 struct scatterlist sg;
577 int err, unused;
578 void *p;
579
580 /* Detach all the used buffers from the vq */
581 while (virtqueue_get_buf(vq, &unused))
582 ;
583
584 page = alloc_pages(VIRTIO_BALLOON_FREE_PAGE_ALLOC_FLAG,
585 VIRTIO_BALLOON_HINT_BLOCK_ORDER);
586 /*
587 * When the allocation returns NULL, it indicates that we have got all
588 * the possible free pages, so return -EINTR to stop.
589 */
590 if (!page)
591 return -EINTR;
592
593 p = page_address(page);
> 594 sg_init_one(&sg, p, VIRTIO_BALLOON_HINT_BLOCK_BYTES);
595 /* There is always 1 entry reserved for the cmd id to use. */
596 if (vq->num_free > 1) {
597 err = virtqueue_add_inbuf(vq, &sg, 1, p, GFP_KERNEL);
598 if (unlikely(err)) {
599 free_pages((unsigned long)p,
600 VIRTIO_BALLOON_HINT_BLOCK_ORDER);
601 return err;
602 }
603 virtqueue_kick(vq);
604 spin_lock_irq(&vb->free_page_list_lock);
605 balloon_page_push(&vb->free_page_list, page);
606 vb->num_free_page_blocks++;
607 spin_unlock_irq(&vb->free_page_list_lock);
608 } else {
609 /*
610 * The vq has no available entry to add this page block, so
611 * just free it.
612 */
613 free_pages((unsigned long)p, VIRTIO_BALLOON_HINT_BLOCK_ORDER);
614 }
615
616 return 0;
617 }
618

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel Corporation

Attachment: .config.gz
Description: application/gzip