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: <225cbd32-09f4-3052-32f5-c61bca07c829@intel.com>
Date:   Mon, 9 May 2022 11:16:15 +0800
From:   kernel test robot <yujie.liu@...el.com>
To:     Allison Henderson <allison.henderson@...cle.com>
CC:     <llvm@...ts.linux.dev>, <kbuild-all@...ts.01.org>,
        "Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>,
        Dave Chinner <dchinner@...hat.com>
Subject: [allisonhenderson-xfs-work:xfs-5.19-compose_pptrs 25/32]
 fs/xfs/libxfs/xfs_attr.c:556:21: warning: Value stored to 'dp' during its
 initialization is never read [clang-analyzer-deadcode.DeadStores]

tree:   https://github.com/allisonhenderson/xfs_work.git xfs-5.19-compose_pptrs
head:   74ecccf0e89a132c2490f3a63661c535974c6a08
commit: 7a5d447970de2d3b003b9015e2bce3bf0d15e3db [25/32] xfs: parent pointer attribute creation
config: x86_64-randconfig-c007 (https://download.01.org/0day-ci/archive/20220508/202205081904.eWJa1zBF-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 5e004fb787698440a387750db7f8028e7cb14cfc)
reproduce (this is a W=1 build):
         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
         chmod +x ~/bin/make.cross
         # https://github.com/allisonhenderson/xfs_work/commit/7a5d447970de2d3b003b9015e2bce3bf0d15e3db
         git remote add allisonhenderson-xfs-work https://github.com/allisonhenderson/xfs_work.git
         git fetch --no-tags allisonhenderson-xfs-work xfs-5.19-compose_pptrs
         git checkout 7a5d447970de2d3b003b9015e2bce3bf0d15e3db
         # save the config file
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer

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


clang-analyzer warnings: (new ones prefixed by >>)

 >> fs/xfs/libxfs/xfs_attr.c:556:21: warning: Value stored to 'dp' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
            struct xfs_inode                *dp = args->dp;
                                             ^~   ~~~~~~~~
 >> fs/xfs/libxfs/xfs_attr.c:559:21: warning: Value stored to 'mp' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
            struct xfs_mount                *mp = args->dp->i_mount;
                                             ^~   ~~~~~~~~~~~~~~~~~

vim +/dp +556 fs/xfs/libxfs/xfs_attr.c

e683cdbb8baf82 Dave Chinner      2022-04-14  542
db1a28cc591c1a Allison Collins   2020-07-20  543  /*
d56c93997e96ed Dave Chinner      2022-04-14  544   * Run the attribute operation specified in @attr.
d56c93997e96ed Dave Chinner      2022-04-14  545   *
d56c93997e96ed Dave Chinner      2022-04-14  546   * This routine is meant to function as a delayed operation and will set the
d56c93997e96ed Dave Chinner      2022-04-14  547   * state to XFS_DAS_DONE when the operation is complete.  Calling functions will
d56c93997e96ed Dave Chinner      2022-04-14  548   * need to handle this, and recall the function until either an error or
d56c93997e96ed Dave Chinner      2022-04-14  549   * XFS_DAS_DONE is detected.
db1a28cc591c1a Allison Collins   2020-07-20  550   */
db1a28cc591c1a Allison Collins   2020-07-20  551  int
8f502a4009822a Allison Henderson 2021-05-21  552  xfs_attr_set_iter(
133b4f4350cc51 Allison Henderson 2022-04-11  553  	struct xfs_attr_item		*attr)
db1a28cc591c1a Allison Collins   2020-07-20  554  {
133b4f4350cc51 Allison Henderson 2022-04-11  555  	struct xfs_da_args              *args = attr->xattri_da_args;
7a5d447970de2d Allison Henderson 2022-03-22 @556  	struct xfs_inode		*dp = args->dp;
7a5d447970de2d Allison Henderson 2022-03-22  557  	struct xfs_buf			*bp = NULL;
7a5d447970de2d Allison Henderson 2022-03-22  558  	int				sf_size, forkoff, error = 0;
7a5d447970de2d Allison Henderson 2022-03-22 @559  	struct xfs_mount		*mp = args->dp->i_mount;
7a5d447970de2d Allison Henderson 2022-03-22  560
db1a28cc591c1a Allison Collins   2020-07-20  561
8f502a4009822a Allison Henderson 2021-05-21  562  	/* State machine switch */
100ba63970eed9 Dave Chinner      2022-04-14  563  next_state:
133b4f4350cc51 Allison Henderson 2022-04-11  564  	switch (attr->xattri_dela_state) {
8f502a4009822a Allison Henderson 2021-05-21  565  	case XFS_DAS_UNINIT:
7a5d447970de2d Allison Henderson 2022-03-22  566  		sf_size = sizeof(struct xfs_attr_sf_hdr) +
7a5d447970de2d Allison Henderson 2022-03-22  567  			  xfs_attr_sf_entsize_byname(args->namelen,
7a5d447970de2d Allison Henderson 2022-03-22  568  							     args->valuelen);
7a5d447970de2d Allison Henderson 2022-03-22  569  		xfs_bmap_set_attrforkoff(args->dp, sf_size, NULL);
7a5d447970de2d Allison Henderson 2022-03-22  570  		args->dp->i_afp = kmem_cache_zalloc(xfs_ifork_cache, 0);
7a5d447970de2d Allison Henderson 2022-03-22  571  		args->dp->i_afp->if_format = XFS_DINODE_FMT_EXTENTS;
5a7bf541843b13 Dave Chinner      2022-04-14  572  	case XFS_DAS_SF_ADD:
133b4f4350cc51 Allison Henderson 2022-04-11  573  		return xfs_attr_sf_addname(attr);
5a7bf541843b13 Dave Chinner      2022-04-14  574  	case XFS_DAS_LEAF_ADD:
133b4f4350cc51 Allison Henderson 2022-04-11  575  		return xfs_attr_leaf_addname(attr);
5a7bf541843b13 Dave Chinner      2022-04-14  576  	case XFS_DAS_NODE_ADD:
5a7bf541843b13 Dave Chinner      2022-04-14  577  		return xfs_attr_node_addname(attr);
3f562d092bb1ed Allison Henderson 2021-02-12  578
b8d9a2124c0193 Dave Chinner      2022-04-14  579  	case XFS_DAS_SF_REMOVE:
f589c4f3a7a7d6 Dave Chinner      2022-04-14  580  		error = xfs_attr_sf_removename(args);
f589c4f3a7a7d6 Dave Chinner      2022-04-14  581  		attr->xattri_dela_state = xfs_attr_complete_op(attr,
f589c4f3a7a7d6 Dave Chinner      2022-04-14  582  						xfs_attr_init_add_state(args));
f589c4f3a7a7d6 Dave Chinner      2022-04-14  583  		break;
b8d9a2124c0193 Dave Chinner      2022-04-14  584  	case XFS_DAS_LEAF_REMOVE:
f589c4f3a7a7d6 Dave Chinner      2022-04-14  585  		error = xfs_attr_leaf_removename(args);
f589c4f3a7a7d6 Dave Chinner      2022-04-14  586  		attr->xattri_dela_state = xfs_attr_complete_op(attr,
f589c4f3a7a7d6 Dave Chinner      2022-04-14  587  						xfs_attr_init_add_state(args));
f589c4f3a7a7d6 Dave Chinner      2022-04-14  588  		break;
b8d9a2124c0193 Dave Chinner      2022-04-14  589  	case XFS_DAS_NODE_REMOVE:
b8d9a2124c0193 Dave Chinner      2022-04-14  590  		error = xfs_attr_node_removename_setup(attr);
b8d9a2124c0193 Dave Chinner      2022-04-14  591  		if (error)
b8d9a2124c0193 Dave Chinner      2022-04-14  592  			return error;
b8d9a2124c0193 Dave Chinner      2022-04-14  593  		attr->xattri_dela_state = XFS_DAS_NODE_REMOVE_RMT;
b8d9a2124c0193 Dave Chinner      2022-04-14  594  		if (args->rmtblkno == 0)
b8d9a2124c0193 Dave Chinner      2022-04-14  595  			attr->xattri_dela_state++;
b8d9a2124c0193 Dave Chinner      2022-04-14  596  		break;
b8d9a2124c0193 Dave Chinner      2022-04-14  597
020dee1bf99e76 Dave Chinner      2022-04-14  598  	case XFS_DAS_LEAF_SET_RMT:
020dee1bf99e76 Dave Chinner      2022-04-14  599  	case XFS_DAS_NODE_SET_RMT:
37e7bb8434f8b2 Allison Henderson 2022-04-11  600  		error = xfs_attr_rmtval_find_space(attr);
83c6e70789ff37 Allison Henderson 2021-04-19  601  		if (error)
83c6e70789ff37 Allison Henderson 2021-04-19  602  			return error;
100ba63970eed9 Dave Chinner      2022-04-14  603  		attr->xattri_dela_state++;
f1fdd499537724 Dave Chinner      2022-04-14  604  		fallthrough;
020dee1bf99e76 Dave Chinner      2022-04-14  605
f1fdd499537724 Dave Chinner      2022-04-14  606  	case XFS_DAS_LEAF_ALLOC_RMT:
100ba63970eed9 Dave Chinner      2022-04-14  607  	case XFS_DAS_NODE_ALLOC_RMT:
020dee1bf99e76 Dave Chinner      2022-04-14  608  		error = xfs_attr_rmtval_alloc(attr);
8f502a4009822a Allison Henderson 2021-05-21  609  		if (error)
8f502a4009822a Allison Henderson 2021-05-21  610  			return error;
f027184d93cf76 Dave Chinner      2022-04-14  611  		/*
f027184d93cf76 Dave Chinner      2022-04-14  612  		 * If there is still more to allocate we need to roll the
f027184d93cf76 Dave Chinner      2022-04-14  613  		 * transaction so we have a full transaction reservation for
f027184d93cf76 Dave Chinner      2022-04-14  614  		 * the next allocation.
f027184d93cf76 Dave Chinner      2022-04-14  615  		 */
f027184d93cf76 Dave Chinner      2022-04-14  616  		if (attr->xattri_blkcnt > 0)
f027184d93cf76 Dave Chinner      2022-04-14  617  			break;
020dee1bf99e76 Dave Chinner      2022-04-14  618  		if (attr->xattri_dela_state == XFS_DAS_DONE)
020dee1bf99e76 Dave Chinner      2022-04-14  619  			break;
f027184d93cf76 Dave Chinner      2022-04-14  620
f027184d93cf76 Dave Chinner      2022-04-14  621  		goto next_state;
83c6e70789ff37 Allison Henderson 2021-04-19  622
020dee1bf99e76 Dave Chinner      2022-04-14  623  	case XFS_DAS_LEAF_REPLACE:
020dee1bf99e76 Dave Chinner      2022-04-14  624  	case XFS_DAS_NODE_REPLACE:
83c6e70789ff37 Allison Henderson 2021-04-19  625  		/*
f027184d93cf76 Dave Chinner      2022-04-14  626  		 * We must "flip" the incomplete flags on the "new" and "old"
f027184d93cf76 Dave Chinner      2022-04-14  627  		 * attribute/value pairs so that one disappears and one appears
6e971e92677394 Dave Chinner      2022-04-14  628  		 * atomically.
83c6e70789ff37 Allison Henderson 2021-04-19  629  		 */
83c6e70789ff37 Allison Henderson 2021-04-19  630  		error = xfs_attr3_leaf_flipflags(args);
83c6e70789ff37 Allison Henderson 2021-04-19  631  		if (error)
83c6e70789ff37 Allison Henderson 2021-04-19  632  			return error;
83c6e70789ff37 Allison Henderson 2021-04-19  633  		/*
6e971e92677394 Dave Chinner      2022-04-14  634  		 * We must commit the flag value change now to make it atomic
6e971e92677394 Dave Chinner      2022-04-14  635  		 * and then we can start the next trans in series at REMOVE_OLD.
83c6e70789ff37 Allison Henderson 2021-04-19  636  		 */
100ba63970eed9 Dave Chinner      2022-04-14  637  		attr->xattri_dela_state++;
020dee1bf99e76 Dave Chinner      2022-04-14  638  		break;
f2d5674061121e Allison Henderson 2022-04-11  639
f027184d93cf76 Dave Chinner      2022-04-14  640  	case XFS_DAS_LEAF_REMOVE_OLD:
f027184d93cf76 Dave Chinner      2022-04-14  641  	case XFS_DAS_NODE_REMOVE_OLD:
83c6e70789ff37 Allison Henderson 2021-04-19  642  		/*
6e971e92677394 Dave Chinner      2022-04-14  643  		 * If we have a remote attr, start the process of removing it
6e971e92677394 Dave Chinner      2022-04-14  644  		 * by invalidating any cached buffers.
6e971e92677394 Dave Chinner      2022-04-14  645  		 *
6e971e92677394 Dave Chinner      2022-04-14  646  		 * If we don't have a remote attr, we skip the remote block
6e971e92677394 Dave Chinner      2022-04-14  647  		 * removal state altogether with a second state increment.
83c6e70789ff37 Allison Henderson 2021-04-19  648  		 */
83c6e70789ff37 Allison Henderson 2021-04-19  649  		xfs_attr_restore_rmt_blk(args);
6e971e92677394 Dave Chinner      2022-04-14  650  		if (args->rmtblkno) {
83c6e70789ff37 Allison Henderson 2021-04-19  651  			error = xfs_attr_rmtval_invalidate(args);
83c6e70789ff37 Allison Henderson 2021-04-19  652  			if (error)
83c6e70789ff37 Allison Henderson 2021-04-19  653  				return error;
6e971e92677394 Dave Chinner      2022-04-14  654  		} else {
6e971e92677394 Dave Chinner      2022-04-14  655  			attr->xattri_dela_state++;
6e971e92677394 Dave Chinner      2022-04-14  656  		}
83c6e70789ff37 Allison Henderson 2021-04-19  657
100ba63970eed9 Dave Chinner      2022-04-14  658  		attr->xattri_dela_state++;
6e971e92677394 Dave Chinner      2022-04-14  659  		goto next_state;
6e971e92677394 Dave Chinner      2022-04-14  660
6e971e92677394 Dave Chinner      2022-04-14  661  	case XFS_DAS_LEAF_REMOVE_RMT:
6e971e92677394 Dave Chinner      2022-04-14  662  	case XFS_DAS_NODE_REMOVE_RMT:
37e7bb8434f8b2 Allison Henderson 2022-04-11  663  		error = xfs_attr_rmtval_remove(attr);
d56c93997e96ed Dave Chinner      2022-04-14  664  		if (error == -EAGAIN) {
d56c93997e96ed Dave Chinner      2022-04-14  665  			error = 0;
6e971e92677394 Dave Chinner      2022-04-14  666  			break;
d56c93997e96ed Dave Chinner      2022-04-14  667  		}
83c6e70789ff37 Allison Henderson 2021-04-19  668  		if (error)
83c6e70789ff37 Allison Henderson 2021-04-19  669  			return error;
8f502a4009822a Allison Henderson 2021-05-21  670
100ba63970eed9 Dave Chinner      2022-04-14  671  		/*
6e971e92677394 Dave Chinner      2022-04-14  672  		 * We've finished removing the remote attr blocks, so commit the
6e971e92677394 Dave Chinner      2022-04-14  673  		 * transaction and move on to removing the attr name from the
6e971e92677394 Dave Chinner      2022-04-14  674  		 * leaf/node block. Removing the attr might require a full
6e971e92677394 Dave Chinner      2022-04-14  675  		 * transaction reservation for btree block freeing, so we
6e971e92677394 Dave Chinner      2022-04-14  676  		 * can't do that in the same transaction where we removed the
6e971e92677394 Dave Chinner      2022-04-14  677  		 * remote attr blocks.
100ba63970eed9 Dave Chinner      2022-04-14  678  		 */
100ba63970eed9 Dave Chinner      2022-04-14  679  		attr->xattri_dela_state++;
6e971e92677394 Dave Chinner      2022-04-14  680  		break;
100ba63970eed9 Dave Chinner      2022-04-14  681
e683cdbb8baf82 Dave Chinner      2022-04-14  682  	case XFS_DAS_LEAF_REMOVE_ATTR:
e683cdbb8baf82 Dave Chinner      2022-04-14  683  		error = xfs_attr_leaf_remove_attr(attr);
f589c4f3a7a7d6 Dave Chinner      2022-04-14  684  		attr->xattri_dela_state = xfs_attr_complete_op(attr,
f589c4f3a7a7d6 Dave Chinner      2022-04-14  685  						xfs_attr_init_add_state(args));
e683cdbb8baf82 Dave Chinner      2022-04-14  686  		break;
5d954cc09f6bae Allison Henderson 2021-04-26  687
e683cdbb8baf82 Dave Chinner      2022-04-14  688  	case XFS_DAS_NODE_REMOVE_ATTR:
e683cdbb8baf82 Dave Chinner      2022-04-14  689  		error = xfs_attr_node_remove_attr(attr);
f589c4f3a7a7d6 Dave Chinner      2022-04-14  690  		attr->xattri_dela_state = xfs_attr_complete_op(attr,
f589c4f3a7a7d6 Dave Chinner      2022-04-14  691  						xfs_attr_init_add_state(args));
8f502a4009822a Allison Henderson 2021-05-21  692  		break;
8f502a4009822a Allison Henderson 2021-05-21  693  	default:
4a4957c16dc674 Allison Henderson 2021-05-21  694  		ASSERT(0);
8f502a4009822a Allison Henderson 2021-05-21  695  		break;
8f502a4009822a Allison Henderson 2021-05-21  696  	}
020dee1bf99e76 Dave Chinner      2022-04-14  697
020dee1bf99e76 Dave Chinner      2022-04-14  698  	trace_xfs_attr_set_iter_return(attr->xattri_dela_state, args->dp);
6ca5a4a1f52952 Allison Henderson 2021-04-12  699  	return error;
2f3cd809196381 Allison Henderson 2018-10-18  700  }
2f3cd809196381 Allison Henderson 2018-10-18  701

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ