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]
Message-ID: <202312050023.G2CGeL05-lkp@intel.com>
Date:   Tue, 5 Dec 2023 00:26:59 +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/snapshot.c:974:17: sparse: sparse: cast from restricted
 __le32

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   33cc938e65a98f1d29d0a18403dbbee050dcad9a
commit: 8e877caaad818595ecb6754355cea2058fd9848e bcachefs: Split out snapshot.c
date:   6 weeks ago
config: mips-randconfig-r132-20231115 (https://download.01.org/0day-ci/archive/20231205/202312050023.G2CGeL05-lkp@intel.com/config)
compiler: mips-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231205/202312050023.G2CGeL05-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/202312050023.G2CGeL05-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> fs/bcachefs/snapshot.c:974:17: sparse: sparse: cast from restricted __le32

vim +974 fs/bcachefs/snapshot.c

   916	
   917	static int bch2_snapshot_node_delete(struct btree_trans *trans, u32 id)
   918	{
   919		struct bch_fs *c = trans->c;
   920		struct btree_iter iter, p_iter = (struct btree_iter) { NULL };
   921		struct btree_iter tree_iter = (struct btree_iter) { NULL };
   922		struct bkey_s_c_snapshot s;
   923		u32 parent_id;
   924		unsigned i;
   925		int ret = 0;
   926	
   927		s = bch2_bkey_get_iter_typed(trans, &iter, BTREE_ID_snapshots, POS(0, id),
   928					     BTREE_ITER_INTENT, snapshot);
   929		ret = bkey_err(s);
   930		bch2_fs_inconsistent_on(bch2_err_matches(ret, ENOENT), c,
   931					"missing snapshot %u", id);
   932	
   933		if (ret)
   934			goto err;
   935	
   936		BUG_ON(!BCH_SNAPSHOT_DELETED(s.v));
   937		parent_id = le32_to_cpu(s.v->parent);
   938	
   939		if (parent_id) {
   940			struct bkey_i_snapshot *parent;
   941	
   942			parent = bch2_bkey_get_mut_typed(trans, &p_iter,
   943					     BTREE_ID_snapshots, POS(0, parent_id),
   944					     0, snapshot);
   945			ret = PTR_ERR_OR_ZERO(parent);
   946			if (unlikely(ret)) {
   947				bch2_fs_inconsistent_on(bch2_err_matches(ret, ENOENT), c,
   948							"missing snapshot %u", parent_id);
   949				goto err;
   950			}
   951	
   952			for (i = 0; i < 2; i++)
   953				if (le32_to_cpu(parent->v.children[i]) == id)
   954					break;
   955	
   956			if (i == 2)
   957				bch_err(c, "snapshot %u missing child pointer to %u",
   958					parent_id, id);
   959			else
   960				parent->v.children[i] = 0;
   961	
   962			if (le32_to_cpu(parent->v.children[0]) <
   963			    le32_to_cpu(parent->v.children[1]))
   964				swap(parent->v.children[0],
   965				     parent->v.children[1]);
   966		} else {
   967			/*
   968			 * We're deleting the root of a snapshot tree: update the
   969			 * snapshot_tree entry to point to the new root, or delete it if
   970			 * this is the last snapshot ID in this tree:
   971			 */
   972			struct bkey_i_snapshot_tree *s_t;
   973	
 > 974			BUG_ON(s.v->children[1]);
   975	
   976			s_t = bch2_bkey_get_mut_typed(trans, &tree_iter,
   977					BTREE_ID_snapshot_trees, POS(0, le32_to_cpu(s.v->tree)),
   978					0, snapshot_tree);
   979			ret = PTR_ERR_OR_ZERO(s_t);
   980			if (ret)
   981				goto err;
   982	
   983			if (s.v->children[0]) {
   984				s_t->v.root_snapshot = s.v->children[0];
   985			} else {
   986				s_t->k.type = KEY_TYPE_deleted;
   987				set_bkey_val_u64s(&s_t->k, 0);
   988			}
   989		}
   990	
   991		ret = bch2_btree_delete_at(trans, &iter, 0);
   992	err:
   993		bch2_trans_iter_exit(trans, &tree_iter);
   994		bch2_trans_iter_exit(trans, &p_iter);
   995		bch2_trans_iter_exit(trans, &iter);
   996		return ret;
   997	}
   998	

-- 
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