public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* fs/init.c:72:8: warning: Variable 'error' is reassigned a value before the old one has been used.
@ 2020-08-08  3:35 kernel test robot
  2020-08-08  5:40 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2020-08-08  3:35 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: kbuild-all, linux-kernel

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   30185b69a2d533c4ba6ca926b8390ce7de495e29
commit: 4b7ca5014cbef51cdb99fd644eae4f3773747a05 init: add an init_chroot helper
date:   8 days ago
compiler: hppa-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


cppcheck warnings: (new ones prefixed by >>)

>> fs/init.c:72:8: warning: Variable 'error' is reassigned a value before the old one has been used. [redundantAssignment]
    error = security_path_chroot(&path);
          ^
   fs/init.c:69:8: note: Variable 'error' is reassigned a value before the old one has been used.
    error = -EPERM;
          ^
   fs/init.c:72:8: note: Variable 'error' is reassigned a value before the old one has been used.
    error = security_path_chroot(&path);
          ^

vim +/error +72 fs/init.c

    57	
    58	int __init init_chroot(const char *filename)
    59	{
    60		struct path path;
    61		int error;
    62	
    63		error = kern_path(filename, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
    64		if (error)
    65			return error;
    66		error = inode_permission(path.dentry->d_inode, MAY_EXEC | MAY_CHDIR);
    67		if (error)
    68			goto dput_and_out;
    69		error = -EPERM;
    70		if (!ns_capable(current_user_ns(), CAP_SYS_CHROOT))
    71			goto dput_and_out;
  > 72		error = security_path_chroot(&path);
    73		if (error)
    74			goto dput_and_out;
    75		set_fs_root(current->fs, &path);
    76	dput_and_out:
    77		path_put(&path);
    78		return error;
    79	}
    80	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-10  9:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-08  3:35 fs/init.c:72:8: warning: Variable 'error' is reassigned a value before the old one has been used kernel test robot
2020-08-08  5:40 ` Christoph Hellwig
2020-08-10  9:28   ` [kbuild-all] " Xia, Hui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox