[linux-next:master 7960/8790] mm/mremap.c:910 prep_move_vma() error: uninitialized symbol 'err'.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   7ec162622e66a4ff886f8f28712ea1b13069e1aa
commit: 3129f7896afb86e411c0b59a553fbb4053db4012 [7960/8790] mm/mremap: initial refactor of move_vma()
config: i386-randconfig-141-20250305 (https://download.01.org/0day-ci/archive/20250306/202503060404.ugZVU72k-lkp@xxxxxxxxx/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
| Closes: https://lore.kernel.org/r/202503060404.ugZVU72k-lkp@xxxxxxxxx/

smatch warnings:
mm/mremap.c:910 prep_move_vma() error: uninitialized symbol 'err'.

vim +/err +910 mm/mremap.c

3129f7896afb86 Lorenzo Stoakes 2025-03-03  892  static unsigned long prep_move_vma(struct vma_remap_struct *vrm,
3129f7896afb86 Lorenzo Stoakes 2025-03-03  893  				   unsigned long *vm_flags_ptr)
3129f7896afb86 Lorenzo Stoakes 2025-03-03  894  {
3129f7896afb86 Lorenzo Stoakes 2025-03-03  895  	unsigned long err;
3129f7896afb86 Lorenzo Stoakes 2025-03-03  896  	struct vm_area_struct *vma = vrm->vma;
3129f7896afb86 Lorenzo Stoakes 2025-03-03  897  	unsigned long old_addr = vrm->addr;
3129f7896afb86 Lorenzo Stoakes 2025-03-03  898  	unsigned long old_len = vrm->old_len;
^1da177e4c3f41 Linus Torvalds  2005-04-16  899  
^1da177e4c3f41 Linus Torvalds  2005-04-16  900  	/*
^1da177e4c3f41 Linus Torvalds  2005-04-16  901  	 * We'd prefer to avoid failure later on in do_munmap:
^1da177e4c3f41 Linus Torvalds  2005-04-16  902  	 * which may split one vma into three before unmapping.
^1da177e4c3f41 Linus Torvalds  2005-04-16  903  	 */
3129f7896afb86 Lorenzo Stoakes 2025-03-03  904  	if (current->mm->map_count >= sysctl_max_map_count - 3)
^1da177e4c3f41 Linus Torvalds  2005-04-16  905  		return -ENOMEM;
^1da177e4c3f41 Linus Torvalds  2005-04-16  906  
73d5e06299195f Dmitry Safonov  2020-12-14  907  	if (vma->vm_ops && vma->vm_ops->may_split) {
73d5e06299195f Dmitry Safonov  2020-12-14  908  		if (vma->vm_start != old_addr)
73d5e06299195f Dmitry Safonov  2020-12-14  909  			err = vma->vm_ops->may_split(vma, old_addr);

Uninitialized on else path.

73d5e06299195f Dmitry Safonov  2020-12-14 @910  		if (!err && vma->vm_end != old_addr + old_len)
73d5e06299195f Dmitry Safonov  2020-12-14  911  			err = vma->vm_ops->may_split(vma, old_addr + old_len);
73d5e06299195f Dmitry Safonov  2020-12-14  912  		if (err)
73d5e06299195f Dmitry Safonov  2020-12-14  913  			return err;
73d5e06299195f Dmitry Safonov  2020-12-14  914  	}
73d5e06299195f Dmitry Safonov  2020-12-14  915  
1ff82995731667 Hugh Dickins    2009-09-21  916  	/*
1ff82995731667 Hugh Dickins    2009-09-21  917  	 * Advise KSM to break any KSM pages in the area to be moved:
1ff82995731667 Hugh Dickins    2009-09-21  918  	 * it would be confusing if they were to turn up at the new
1ff82995731667 Hugh Dickins    2009-09-21  919  	 * location, where they happen to coincide with different KSM
1ff82995731667 Hugh Dickins    2009-09-21  920  	 * pages recently unmapped.  But leave vma->vm_flags as it was,
1ff82995731667 Hugh Dickins    2009-09-21  921  	 * so KSM can come around to merge on vma and new_vma afterwards.
1ff82995731667 Hugh Dickins    2009-09-21  922  	 */
7103ad323b1ae3 Hugh Dickins    2009-09-21  923  	err = ksm_madvise(vma, old_addr, old_addr + old_len,
3129f7896afb86 Lorenzo Stoakes 2025-03-03  924  			  MADV_UNMERGEABLE, vm_flags_ptr);
7103ad323b1ae3 Hugh Dickins    2009-09-21  925  	if (err)
7103ad323b1ae3 Hugh Dickins    2009-09-21  926  		return err;
1ff82995731667 Hugh Dickins    2009-09-21  927  
3129f7896afb86 Lorenzo Stoakes 2025-03-03  928  	return 0;
ad8ee77ea9db1f Dmitry Safonov  2020-12-14  929  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux