tree:
git://git.infradead.org/users/hch/misc.git alloc_vm_area
head: d574728eedb41cee38600f7f2199852e9018a50a
commit: 14e6831d7306306425df24459348bda79c30bb06 [5/7] xen/xenbus: open code alloc_vm_area
in xenbus_map_ring_pv
config: x86_64-randconfig-a006-20200917 (attached as .config)
compiler: clang version 12.0.0 (
https://github.com/llvm/llvm-project
1321160a26e7e489baf9b10d6de90a342f898960)
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 x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git checkout 14e6831d7306306425df24459348bda79c30bb06
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
> drivers/xen/xenbus/xenbus_client.c:710:6: warning: variable
'leaked' is used uninitialized whenever 'if' condition is true
[-Wsometimes-uninitialized]
if (apply_to_page_range(&init_mm,
(unsigned long)area->addr,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/xen/xenbus/xenbus_client.c:734:7: note: uninitialized use occurs here
if (!leaked)
^~~~~~
drivers/xen/xenbus/xenbus_client.c:710:2: note: remove the 'if' if its
condition is always false
if (apply_to_page_range(&init_mm, (unsigned long)area->addr,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/xen/xenbus/xenbus_client.c:704:13: note: initialize the variable
'leaked' to silence this warning
bool leaked;
^
= 0
1 warning generated.
git remote add hch-misc
git://git.infradead.org/users/hch/misc.git
git fetch --no-tags hch-misc alloc_vm_area
git checkout 14e6831d7306306425df24459348bda79c30bb06
vim +710 drivers/xen/xenbus/xenbus_client.c
694
695 static int xenbus_map_ring_pv(struct xenbus_device *dev,
696 struct map_ring_valloc *info,
697 grant_ref_t *gnt_refs,
698 unsigned int nr_grefs,
699 void **vaddr)
700 {
701 struct xenbus_map_node *node = info->node;
702 struct vm_struct *area;
703 int err = -ENOMEM;
704 bool leaked;
705
706 area = get_vm_area_caller(XEN_PAGE_SIZE * nr_grefs, VM_IOREMAP,
707 __builtin_return_address(0));
708 if (!area)
709 return -ENOMEM;
710 if (apply_to_page_range(&init_mm, (unsigned
long)area->addr,
711 XEN_PAGE_SIZE * nr_grefs, map_ring_apply,
712 &info->phys_addrs))
713 goto failed;
714
715 err = __xenbus_map_ring(dev, gnt_refs, nr_grefs, node->handles,
716 info, GNTMAP_host_map | GNTMAP_contains_pte,
717 &leaked);
718 if (err)
719 goto failed;
720
721 node->nr_handles = nr_grefs;
722 node->pv.area = area;
723
724 spin_lock(&xenbus_valloc_lock);
725 list_add(&node->next, &xenbus_valloc_pages);
726 spin_unlock(&xenbus_valloc_lock);
727
728 *vaddr = area->addr;
729 info->node = NULL;
730
731 return 0;
732
733 failed:
734 if (!leaked)
735 free_vm_area(area);
736 else
737 pr_alert("leaking VM area %p size %u page(s)", area, nr_grefs);
738
739 return err;
740 }
741
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org