Skip to contentSkip to conversation

fs/xfs/scrub/rtsummary.c:75 xchk_setup_rtsummary() error: uninitialized symbol 'resblks'.

PATCH New Dan Carpenter 1 participant 1 message May 26, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 77/229 fs/xfs/scrub/rtsummary.c:75 xchk_setup_rtsummary() error: uninitialized symbol 'resblks'.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git repair-metadata-atomically
head:   d334005df02786c9f288f2c7060603e9680946b5
commit: 0d44a170037d3e6825d8ca4b52f3cf6019a40850 [77/229] xfs: online repair of realtime summaries

config: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0

If you fix the issue, kindly add following tag as appropriate

smatch warnings:
fs/xfs/scrub/rtsummary.c:75 xchk_setup_rtsummary() error: uninitialized symbol 'resblks'.

# https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/commit/?id=0d44a170037d3e6825d8ca4b52f3cf6019a40850
git remote add djwong-xfs https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
git remote update djwong-xfs
git checkout 0d44a170037d3e6825d8ca4b52f3cf6019a40850
vim +/resblks +75 fs/xfs/scrub/rtsummary.c

7a9053f61cc608e Darrick J. Wong 2020-03-10  56  int
d11bb52d9fe16ea Darrick J. Wong 2020-03-16  57  xchk_setup_rtsummary(
d11bb52d9fe16ea Darrick J. Wong 2020-03-16  58  	struct xfs_scrub	*sc,
d11bb52d9fe16ea Darrick J. Wong 2020-03-16  59  	struct xfs_inode	*ip)
7a9053f61cc608e Darrick J. Wong 2020-03-10  60  {
d11bb52d9fe16ea Darrick J. Wong 2020-03-16  61  	struct xfs_mount	*mp = sc->mp;
0d44a170037d3e6 Darrick J. Wong 2020-03-12  62  	unsigned long long	resblks;
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
d11bb52d9fe16ea Darrick J. Wong 2020-03-16  63  	int			error;
d11bb52d9fe16ea Darrick J. Wong 2020-03-16  64  
0d44a170037d3e6 Darrick J. Wong 2020-03-12  65  	/*
0d44a170037d3e6 Darrick J. Wong 2020-03-12  66  	 * If we're doing a repair, we reserve 2x the summary blocks: once for
0d44a170037d3e6 Darrick J. Wong 2020-03-12  67  	 * the new summary contents and again for the bmbt blocks and the
0d44a170037d3e6 Darrick J. Wong 2020-03-12  68  	 * remapping operation.
0d44a170037d3e6 Darrick J. Wong 2020-03-12  69  	 */
0d44a170037d3e6 Darrick J. Wong 2020-03-12  70  	if (sc->sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR) {
0d44a170037d3e6 Darrick J. Wong 2020-03-12  71  		resblks = XFS_B_TO_FSB(sc->mp, sc->mp->m_rsumsize) * 2;
                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0d44a170037d3e6 Darrick J. Wong 2020-03-12  72  		if (resblks > UINT_MAX)
0d44a170037d3e6 Darrick J. Wong 2020-03-12  73  			return -EOPNOTSUPP;
0d44a170037d3e6 Darrick J. Wong 2020-03-12  74  	}
0d44a170037d3e6 Darrick J. Wong 2020-03-12 @75  	error = xchk_trans_alloc(sc, resblks);
                                                                                     ^^^^^^^

Uninitialized on else path.

d11bb52d9fe16ea Darrick J. Wong 2020-03-16  76  	if (error)
d11bb52d9fe16ea Darrick J. Wong 2020-03-16  77  		return error;
d11bb52d9fe16ea Darrick J. Wong 2020-03-16  78  
d11bb52d9fe16ea Darrick J. Wong 2020-03-16  79  	/* Allocate a memory buffer for the summary comparison. */
d11bb52d9fe16ea Darrick J. Wong 2020-03-16  80  	sc->buf = kmem_alloc_large(sc->mp->m_sb.sb_blocksize, KM_MAYFAIL);
d11bb52d9fe16ea Darrick J. Wong 2020-03-16  81  	if (!sc->buf)
d11bb52d9fe16ea Darrick J. Wong 2020-03-16  82  		return -ENOMEM;
7a9053f61cc608e Darrick J. Wong 2020-03-10  83  
7a9053f61cc608e Darrick J. Wong 2020-03-10  84  	/*
d11bb52d9fe16ea Darrick J. Wong 2020-03-16  85  	 * Locking order requires us to take the rtbitmap first.  We must be
d11bb52d9fe16ea Darrick J. Wong 2020-03-16  86  	 * careful to unlock it ourselves when we are done with the rtbitmap
d11bb52d9fe16ea Darrick J. Wong 2020-03-16  87  	 * file since the scrub infrastructure won't do that for us.
7a9053f61cc608e Darrick J. Wong 2020-03-10  88  	 */
d11bb52d9fe16ea Darrick J. Wong 2020-03-16  89  	xfs_ilock(mp->m_rbmip, XFS_ILOCK_SHARED | XFS_ILOCK_RTBITMAP);
d11bb52d9fe16ea Darrick J. Wong 2020-03-16  90  
d11bb52d9fe16ea Darrick J. Wong 2020-03-16  91  	/* ...and then we can lock the rtsummary inode. */
7a9053f61cc608e Darrick J. Wong 2020-03-10  92  	sc->ilock_flags = XFS_ILOCK_EXCL | XFS_ILOCK_RTSUM;
d11bb52d9fe16ea Darrick J. Wong 2020-03-16  93  	sc->ip = sc->mp->m_rsumip;
7a9053f61cc608e Darrick J. Wong 2020-03-10  94  	xfs_ilock(sc->ip, sc->ilock_flags);
7a9053f61cc608e Darrick J. Wong 2020-03-10  95  
d11bb52d9fe16ea Darrick J. Wong 2020-03-16  96  	return 0;
d11bb52d9fe16ea Darrick J. Wong 2020-03-16  97  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org