lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Tue, 5 Dec 2023 17:04:12 +0800
From:   kernel test robot <lkp@...el.com>
To:     Kent Overstreet <kmo@...erainc.com>
Cc:     oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: fs/bcachefs/btree_io.c:812:5-8: Unneeded variable: "ret". Return "
  0" on line 900

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   bee0e7762ad2c6025b9f5245c040fcc36ef2bde8
commit: 39fb2983c5862933798cdd1b59da180bc9642910 bcachefs: Kill bkey_type_successor
date:   6 weeks ago
config: x86_64-randconfig-104-20231204 (https://download.01.org/0day-ci/archive/20231205/202312051654.iKqsZSPl-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce: (https://download.01.org/0day-ci/archive/20231205/202312051654.iKqsZSPl-lkp@intel.com/reproduce)

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

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

vim +812 fs/bcachefs/btree_io.c

   804	
   805	static int validate_bset_keys(struct bch_fs *c, struct btree *b,
   806				 struct bset *i, unsigned *whiteout_u64s,
   807				 int write, bool have_retry)
   808	{
   809		unsigned version = le16_to_cpu(i->version);
   810		struct bkey_packed *k, *prev = NULL;
   811		bool seen_non_whiteout = false;
 > 812		int ret = 0;
   813	
   814		if (!BSET_SEPARATE_WHITEOUTS(i)) {
   815			seen_non_whiteout = true;
   816			*whiteout_u64s = 0;
   817		}
   818	
   819		for (k = i->start;
   820		     k != vstruct_last(i);) {
   821			struct bkey_s u;
   822			struct bkey tmp;
   823			const char *invalid;
   824	
   825			if (btree_err_on(bkey_next(k) > vstruct_last(i),
   826					 BTREE_ERR_FIXABLE, c, b, i,
   827					 "key extends past end of bset")) {
   828				i->u64s = cpu_to_le16((u64 *) k - i->_data);
   829				break;
   830			}
   831	
   832			if (btree_err_on(k->format > KEY_FORMAT_CURRENT,
   833					 BTREE_ERR_FIXABLE, c, b, i,
   834					 "invalid bkey format %u", k->format)) {
   835				i->u64s = cpu_to_le16(le16_to_cpu(i->u64s) - k->u64s);
   836				memmove_u64s_down(k, bkey_next(k),
   837						  (u64 *) vstruct_end(i) - (u64 *) k);
   838				continue;
   839			}
   840	
   841			/* XXX: validate k->u64s */
   842			if (!write)
   843				bch2_bkey_compat(b->c.level, b->c.btree_id, version,
   844					    BSET_BIG_ENDIAN(i), write,
   845					    &b->format, k);
   846	
   847			u = __bkey_disassemble(b, k, &tmp);
   848	
   849			invalid = __bch2_bkey_invalid(c, u.s_c, btree_node_type(b)) ?:
   850				bch2_bkey_in_btree_node(b, u.s_c) ?:
   851				(write ? bch2_bkey_val_invalid(c, u.s_c) : NULL);
   852			if (invalid) {
   853				char buf[160];
   854	
   855				bch2_bkey_val_to_text(&PBUF(buf), c, u.s_c);
   856				btree_err(BTREE_ERR_FIXABLE, c, b, i,
   857					  "invalid bkey:\n%s\n%s", invalid, buf);
   858	
   859				i->u64s = cpu_to_le16(le16_to_cpu(i->u64s) - k->u64s);
   860				memmove_u64s_down(k, bkey_next(k),
   861						  (u64 *) vstruct_end(i) - (u64 *) k);
   862				continue;
   863			}
   864	
   865			if (write)
   866				bch2_bkey_compat(b->c.level, b->c.btree_id, version,
   867					    BSET_BIG_ENDIAN(i), write,
   868					    &b->format, k);
   869	
   870			/*
   871			 * with the separate whiteouts thing (used for extents), the
   872			 * second set of keys actually can have whiteouts too, so we
   873			 * can't solely go off bkey_whiteout()...
   874			 */
   875	
   876			if (!seen_non_whiteout &&
   877			    (!bkey_whiteout(k) ||
   878			     (prev && bkey_iter_cmp(b, prev, k) > 0))) {
   879				*whiteout_u64s = k->_data - i->_data;
   880				seen_non_whiteout = true;
   881			} else if (prev && bkey_iter_cmp(b, prev, k) > 0) {
   882				char buf1[80];
   883				char buf2[80];
   884				struct bkey up = bkey_unpack_key(b, prev);
   885	
   886				bch2_bkey_to_text(&PBUF(buf1), &up);
   887				bch2_bkey_to_text(&PBUF(buf2), u.k);
   888	
   889				bch2_dump_bset(b, i, 0);
   890				btree_err(BTREE_ERR_FATAL, c, b, i,
   891					  "keys out of order: %s > %s",
   892					  buf1, buf2);
   893				/* XXX: repair this */
   894			}
   895	
   896			prev = k;
   897			k = bkey_next_skip_noops(k, vstruct_last(i));
   898		}
   899	fsck_err:
 > 900		return ret;
   901	}
   902	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ