The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* fs/bcachefs/dirent.c:106:5-8: Unneeded variable: "ret". Return "  0" on line 144
@ 2023-12-19 14:38 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-12-19 14:38 UTC (permalink / raw)
  To: Kent Overstreet; +Cc: oe-kbuild-all, linux-kernel

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   2cf4f94d8e8646803f8fb0facf134b0cd7fb691a
commit: b65db750e2bb9252321fd54c284edd73c1595a09 bcachefs: Enumerate fsck errors
date:   7 weeks ago
config: x86_64-randconfig-102-20231219 (https://download.01.org/0day-ci/archive/20231219/202312192216.GSjjPurf-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)

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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312192216.GSjjPurf-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> fs/bcachefs/dirent.c:106:5-8: Unneeded variable: "ret". Return "  0" on line 144

vim +106 fs/bcachefs/dirent.c

    99	
   100	int bch2_dirent_invalid(struct bch_fs *c, struct bkey_s_c k,
   101				enum bkey_invalid_flags flags,
   102				struct printbuf *err)
   103	{
   104		struct bkey_s_c_dirent d = bkey_s_c_to_dirent(k);
   105		struct qstr d_name = bch2_dirent_get_name(d);
 > 106		int ret = 0;
   107	
   108		bkey_fsck_err_on(!d_name.len, c, err,
   109				 dirent_empty_name,
   110				 "empty name");
   111	
   112		bkey_fsck_err_on(bkey_val_u64s(k.k) > dirent_val_u64s(d_name.len), c, err,
   113				 dirent_val_too_big,
   114				 "value too big (%zu > %u)",
   115				 bkey_val_u64s(k.k), dirent_val_u64s(d_name.len));
   116	
   117		/*
   118		 * Check new keys don't exceed the max length
   119		 * (older keys may be larger.)
   120		 */
   121		bkey_fsck_err_on((flags & BKEY_INVALID_COMMIT) && d_name.len > BCH_NAME_MAX, c, err,
   122				 dirent_name_too_long,
   123				 "dirent name too big (%u > %u)",
   124				 d_name.len, BCH_NAME_MAX);
   125	
   126		bkey_fsck_err_on(d_name.len != strnlen(d_name.name, d_name.len), c, err,
   127				 dirent_name_embedded_nul,
   128				 "dirent has stray data after name's NUL");
   129	
   130		bkey_fsck_err_on((d_name.len == 1 && !memcmp(d_name.name, ".", 1)) ||
   131				 (d_name.len == 2 && !memcmp(d_name.name, "..", 2)), c, err,
   132				 dirent_name_dot_or_dotdot,
   133				 "invalid name");
   134	
   135		bkey_fsck_err_on(memchr(d_name.name, '/', d_name.len), c, err,
   136				 dirent_name_has_slash,
   137				 "name with /");
   138	
   139		bkey_fsck_err_on(d.v->d_type != DT_SUBVOL &&
   140				 le64_to_cpu(d.v->d_inum) == d.k->p.inode, c, err,
   141				 dirent_to_itself,
   142				 "dirent points to own directory");
   143	fsck_err:
 > 144		return ret;
   145	}
   146	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-12-19 14:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-19 14:38 fs/bcachefs/dirent.c:106:5-8: Unneeded variable: "ret". Return " 0" on line 144 kernel test robot

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