The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: fs/bcachefs/dirent.c:106:5-8: Unneeded variable: "ret". Return "  0" on line 144
Date: Tue, 19 Dec 2023 22:38:28 +0800	[thread overview]
Message-ID: <202312192216.GSjjPurf-lkp@intel.com> (raw)

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

                 reply	other threads:[~2023-12-19 14:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202312192216.GSjjPurf-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@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