Content-Type: multipart/mixed; boundary="===============3814719330170515375==" MIME-Version: 1.0 From: Zach O'Keefe To: kbuild-all@lists.01.org Subject: Re: [akpm-mm:mm-unstable 284/293] mm/khugepaged.c:2409 madvise_collapse() warn: possible memory leak of 'cc' Date: Tue, 12 Jul 2022 06:46:48 -0700 Message-ID: In-Reply-To: <202207100715.TBIYQ4fc-lkp@intel.com> List-Id: --===============3814719330170515375== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Jul 12 15:35, Dan Carpenter wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-un= stable > head: 0e9f775fb0b4adf1a4ef50ea156ead09a0fc5194 > commit: 9f626ffb1d1c5c26b4a8e0fdffec784a5f773274 [284/293] mm/madvise: in= troduce MADV_COLLAPSE sync hugepage collapse > config: i386-randconfig-m021 (https://download.01.org/0day-ci/archive/202= 20710/202207100715.TBIYQ4fc-lkp(a)intel.com/config) > compiler: gcc-11 (Debian 11.3.0-3) 11.3.0 > = > If you fix the issue, kindly add following tag where applicable > Reported-by: kernel test robot > Reported-by: Dan Carpenter > = > smatch warnings: > mm/khugepaged.c:2409 madvise_collapse() warn: possible memory leak of 'cc' > = > vim +/cc +2409 mm/khugepaged.c > = > 9f626ffb1d1c5c Zach O'Keefe 2022-07-06 2387 int madvise_collapse(struct= vm_area_struct *vma, struct vm_area_struct **prev, > 9f626ffb1d1c5c Zach O'Keefe 2022-07-06 2388 unsigned long start,= unsigned long end) > 9f626ffb1d1c5c Zach O'Keefe 2022-07-06 2389 { > 9f626ffb1d1c5c Zach O'Keefe 2022-07-06 2390 struct collapse_control *c= c; > 9f626ffb1d1c5c Zach O'Keefe 2022-07-06 2391 struct mm_struct *mm =3D v= ma->vm_mm; > 9f626ffb1d1c5c Zach O'Keefe 2022-07-06 2392 unsigned long hstart, hend= , addr; > 9f626ffb1d1c5c Zach O'Keefe 2022-07-06 2393 int thps =3D 0, last_fail = =3D SCAN_FAIL; > 9f626ffb1d1c5c Zach O'Keefe 2022-07-06 2394 bool mmap_locked =3D true; > 9f626ffb1d1c5c Zach O'Keefe 2022-07-06 2395 = > 9f626ffb1d1c5c Zach O'Keefe 2022-07-06 2396 BUG_ON(vma->vm_start > sta= rt); > 9f626ffb1d1c5c Zach O'Keefe 2022-07-06 2397 BUG_ON(vma->vm_end < end); > 9f626ffb1d1c5c Zach O'Keefe 2022-07-06 2398 = > 9f626ffb1d1c5c Zach O'Keefe 2022-07-06 2399 cc =3D kmalloc(sizeof(*cc)= , GFP_KERNEL); > 9f626ffb1d1c5c Zach O'Keefe 2022-07-06 2400 if (!cc) > 9f626ffb1d1c5c Zach O'Keefe 2022-07-06 2401 return -ENOMEM; > 9f626ffb1d1c5c Zach O'Keefe 2022-07-06 2402 cc->is_khugepaged =3D fals= e; > 9f626ffb1d1c5c Zach O'Keefe 2022-07-06 2403 cc->last_target_node =3D N= UMA_NO_NODE; > 9f626ffb1d1c5c Zach O'Keefe 2022-07-06 2404 = > 9f626ffb1d1c5c Zach O'Keefe 2022-07-06 2405 *prev =3D vma; > 9f626ffb1d1c5c Zach O'Keefe 2022-07-06 2406 = > 9f626ffb1d1c5c Zach O'Keefe 2022-07-06 2407 /* TODO: Support file/shme= m */ > 9f626ffb1d1c5c Zach O'Keefe 2022-07-06 2408 if (!vma->anon_vma || !vma= _is_anonymous(vma)) > 9f626ffb1d1c5c Zach O'Keefe 2022-07-06 @2409 return -EINVAL; > = > kfree(cc);? > = > = > -- = > 0-DAY CI Kernel Test Service > https://01.org/lkp > = Yikes. Glad this was caught - my apologies here. Thanks Dan/lkp! --===============3814719330170515375==--