From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============7492000653495387539==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: Re: [PATCH 16/24] init: add an init_chroot helper Date: Sun, 02 Aug 2020 02:43:26 +0800 Message-ID: <202008020234.kQwh91Tm%lkp@intel.com> In-Reply-To: <20200721162818.197315-17-hch@lst.de> List-Id: --===============7492000653495387539== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Christoph, I love your patch! Perhaps something to improve: [auto build test WARNING on next-20200721] [cannot apply to driver-core/driver-core-testing linux/master song-md/md-ne= xt linus/master v5.8-rc6 v5.8-rc5 v5.8-rc4 v5.8-rc7] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Christoph-Hellwig/fs-refac= tor-do_mount/20200722-012830 base: de2e69cfe54a8f2ed4b75f09d3110c514f45d38e compiler: mips-linux-gcc (GCC) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot cppcheck warnings: (new ones prefixed by >>) >> init/fs.c:53:8: warning: Variable 'error' is reassigned a value before t= he old one has been used. [redundantAssignment] error =3D security_path_chroot(&path); ^ init/fs.c:50:8: note: Variable 'error' is reassigned a value before the = old one has been used. error =3D -EPERM; ^ init/fs.c:53:8: note: Variable 'error' is reassigned a value before the = old one has been used. error =3D security_path_chroot(&path); ^ -- >> init/initramfs.c:109:6: warning: Local variable error shadows outer func= tion [shadowFunction] int error; ^ init/initramfs.c:41:20: note: Shadowed declaration static void __init error(char *x) ^ init/initramfs.c:109:6: note: Shadow variable int error; ^ vim +/error +53 init/fs.c 38 = 39 int __init init_chroot(const char *filename) 40 { 41 struct path path; 42 int error; 43 = 44 error =3D kern_path(filename, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &pa= th); 45 if (error) 46 return error; 47 error =3D inode_permission(path.dentry->d_inode, MAY_EXEC | MAY_CHD= IR); 48 if (error) 49 goto dput_and_out; 50 error =3D -EPERM; 51 if (!ns_capable(current_user_ns(), CAP_SYS_CHROOT)) 52 goto dput_and_out; > 53 error =3D security_path_chroot(&path); 54 if (error) 55 goto dput_and_out; 56 set_fs_root(current->fs, &path); 57 dput_and_out: 58 path_put(&path); 59 return error; 60 } 61 = --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============7492000653495387539==--