From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: oe-kbuild@lists.linux.dev, lkp@intel.com,
oe-kbuild-all@lists.linux.dev,
Andrew Morton <akpm@linux-foundation.org>,
Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [linux-next:master 7960/8790] mm/mremap.c:910 prep_move_vma() error: uninitialized symbol 'err'.
Date: Thu, 6 Mar 2025 07:59:27 +0000 [thread overview]
Message-ID: <2d3dd490-8daf-4729-ada0-8a190a79af15@lucifer.local> (raw)
In-Reply-To: <701a7c3d-345a-4ed4-84bc-f34c5164f9ea@stanley.mountain>
On Thu, Mar 06, 2025 at 09:27:54AM +0300, Dan Carpenter wrote:
> 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@intel.com/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@intel.com>
> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> | Closes: https://lore.kernel.org/r/202503060404.ugZVU72k-lkp@intel.com/
>
> smatch warnings:
> mm/mremap.c:910 prep_move_vma() error: uninitialized symbol 'err'.
Thanks, this has already been addressed and will land in -next soon.
>
> 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
>
prev parent reply other threads:[~2025-03-06 7:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-06 6:27 Dan Carpenter
2025-03-06 7:59 ` Lorenzo Stoakes [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2d3dd490-8daf-4729-ada0-8a190a79af15@lucifer.local \
--to=lorenzo.stoakes@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=dan.carpenter@linaro.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox