CC: [email protected]
BCC: [email protected]
CC: [email protected]
TO: SeongJae Park <[email protected]>
CC: Leonard Foerster <[email protected]>
CC: Fernand Sieber <[email protected]>
CC: Andrew Morton <[email protected]>
CC: Linux Memory Management List <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   e71e60cd74df9386c3f684c54888f2367050b831
commit: 3f49584b262cf8f42b25f4c1ad9f5bfd3bdc1bca mm/damon: implement primitives 
for the virtual memory address spaces
date:   9 months ago
:::::: branch date: 6 hours ago
:::::: commit date: 9 months ago
config: x86_64-rhel-8.3-kselftests 
(https://download.01.org/0day-ci/archive/20220607/[email protected]/config)
compiler: gcc-11 (Debian 11.3.0-1) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

smatch warnings:
mm/damon/vaddr.c:158 __damon_va_three_regions() error: uninitialized symbol 
'start'.

vim +/start +158 mm/damon/vaddr.c

3f49584b262cf8f SeongJae Park 2021-09-07  109  
3f49584b262cf8f SeongJae Park 2021-09-07  110  /*
3f49584b262cf8f SeongJae Park 2021-09-07  111   * Find three regions separated 
by two biggest unmapped regions
3f49584b262cf8f SeongJae Park 2021-09-07  112   *
3f49584b262cf8f SeongJae Park 2021-09-07  113   * vma           the head vma of 
the target address space
3f49584b262cf8f SeongJae Park 2021-09-07  114   * regions       an array of 
three address ranges that results will be saved
3f49584b262cf8f SeongJae Park 2021-09-07  115   *
3f49584b262cf8f SeongJae Park 2021-09-07  116   * This function receives an 
address space and finds three regions in it which
3f49584b262cf8f SeongJae Park 2021-09-07  117   * separated by the two biggest 
unmapped regions in the space.  Please refer to
3f49584b262cf8f SeongJae Park 2021-09-07  118   * below comments of 
'__damon_va_init_regions()' function to know why this is
3f49584b262cf8f SeongJae Park 2021-09-07  119   * necessary.
3f49584b262cf8f SeongJae Park 2021-09-07  120   *
3f49584b262cf8f SeongJae Park 2021-09-07  121   * Returns 0 if success, or 
negative error code otherwise.
3f49584b262cf8f SeongJae Park 2021-09-07  122   */
3f49584b262cf8f SeongJae Park 2021-09-07  123  static int 
__damon_va_three_regions(struct vm_area_struct *vma,
3f49584b262cf8f SeongJae Park 2021-09-07  124                                  
struct damon_addr_range regions[3])
3f49584b262cf8f SeongJae Park 2021-09-07  125  {
3f49584b262cf8f SeongJae Park 2021-09-07  126   struct damon_addr_range gap = 
{0}, first_gap = {0}, second_gap = {0};
3f49584b262cf8f SeongJae Park 2021-09-07  127   struct vm_area_struct *last_vma 
= NULL;
3f49584b262cf8f SeongJae Park 2021-09-07  128   unsigned long start = 0;
3f49584b262cf8f SeongJae Park 2021-09-07  129   struct rb_root rbroot;
3f49584b262cf8f SeongJae Park 2021-09-07  130  
3f49584b262cf8f SeongJae Park 2021-09-07  131   /* Find two biggest gaps so 
that first_gap > second_gap > others */
3f49584b262cf8f SeongJae Park 2021-09-07  132   for (; vma; vma = vma->vm_next) 
{
3f49584b262cf8f SeongJae Park 2021-09-07  133           if (!last_vma) {
3f49584b262cf8f SeongJae Park 2021-09-07  134                   start = 
vma->vm_start;
3f49584b262cf8f SeongJae Park 2021-09-07  135                   goto next;
3f49584b262cf8f SeongJae Park 2021-09-07  136           }
3f49584b262cf8f SeongJae Park 2021-09-07  137  
3f49584b262cf8f SeongJae Park 2021-09-07  138           if (vma->rb_subtree_gap 
<= sz_range(&second_gap)) {
3f49584b262cf8f SeongJae Park 2021-09-07  139                   rbroot.rb_node 
= &vma->vm_rb;
3f49584b262cf8f SeongJae Park 2021-09-07  140                   vma = 
rb_entry(rb_last(&rbroot),
3f49584b262cf8f SeongJae Park 2021-09-07  141                                   
struct vm_area_struct, vm_rb);
3f49584b262cf8f SeongJae Park 2021-09-07  142                   goto next;
3f49584b262cf8f SeongJae Park 2021-09-07  143           }
3f49584b262cf8f SeongJae Park 2021-09-07  144  
3f49584b262cf8f SeongJae Park 2021-09-07  145           gap.start = 
last_vma->vm_end;
3f49584b262cf8f SeongJae Park 2021-09-07  146           gap.end = vma->vm_start;
3f49584b262cf8f SeongJae Park 2021-09-07  147           if (sz_range(&gap) > 
sz_range(&second_gap)) {
3f49584b262cf8f SeongJae Park 2021-09-07  148                   
swap_ranges(&gap, &second_gap);
3f49584b262cf8f SeongJae Park 2021-09-07  149                   if 
(sz_range(&second_gap) > sz_range(&first_gap))
3f49584b262cf8f SeongJae Park 2021-09-07  150                           
swap_ranges(&second_gap, &first_gap);
3f49584b262cf8f SeongJae Park 2021-09-07  151           }
3f49584b262cf8f SeongJae Park 2021-09-07  152  next:
3f49584b262cf8f SeongJae Park 2021-09-07  153           last_vma = vma;
3f49584b262cf8f SeongJae Park 2021-09-07  154   }
3f49584b262cf8f SeongJae Park 2021-09-07  155  
3f49584b262cf8f SeongJae Park 2021-09-07  156   if (!sz_range(&second_gap) || 
!sz_range(&first_gap))
3f49584b262cf8f SeongJae Park 2021-09-07  157           return -EINVAL;
3f49584b262cf8f SeongJae Park 2021-09-07 @158  
3f49584b262cf8f SeongJae Park 2021-09-07  159   /* Sort the two biggest gaps by 
address */
3f49584b262cf8f SeongJae Park 2021-09-07  160   if (first_gap.start > 
second_gap.start)
3f49584b262cf8f SeongJae Park 2021-09-07  161           swap_ranges(&first_gap, 
&second_gap);
3f49584b262cf8f SeongJae Park 2021-09-07  162  
3f49584b262cf8f SeongJae Park 2021-09-07  163   /* Store the result */
3f49584b262cf8f SeongJae Park 2021-09-07  164   regions[0].start = ALIGN(start, 
DAMON_MIN_REGION);
3f49584b262cf8f SeongJae Park 2021-09-07  165   regions[0].end = 
ALIGN(first_gap.start, DAMON_MIN_REGION);
3f49584b262cf8f SeongJae Park 2021-09-07  166   regions[1].start = 
ALIGN(first_gap.end, DAMON_MIN_REGION);
3f49584b262cf8f SeongJae Park 2021-09-07  167   regions[1].end = 
ALIGN(second_gap.start, DAMON_MIN_REGION);
3f49584b262cf8f SeongJae Park 2021-09-07  168   regions[2].start = 
ALIGN(second_gap.end, DAMON_MIN_REGION);
3f49584b262cf8f SeongJae Park 2021-09-07  169   regions[2].end = 
ALIGN(last_vma->vm_end, DAMON_MIN_REGION);
3f49584b262cf8f SeongJae Park 2021-09-07  170  
3f49584b262cf8f SeongJae Park 2021-09-07  171   return 0;
3f49584b262cf8f SeongJae Park 2021-09-07  172  }
3f49584b262cf8f SeongJae Park 2021-09-07  173  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to