[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202108171247.zaUhvHhn-lkp@intel.com>
Date: Tue, 17 Aug 2021 12:39:54 +0800
From: kernel test robot <lkp@...el.com>
To: "Darrick J. Wong" <djwong@...nel.org>
Cc: clang-built-linux@...glegroups.com, kbuild-all@...ts.01.org,
"Darrick J. Wong" <darrick.wong@...cle.com>,
linux-kernel@...r.kernel.org
Subject: [djwong-xfs:defrag-freespace 309/310]
fs/xfs/libxfs/xfs_bmap.c:6611:25: warning: variable 'rtxlen_out' is
uninitialized when used here
tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git defrag-freespace
head: eac62500d5481c286ef5fac0873d1707175312b6
commit: e17e75a18c97e1f807f4e82707349ffa38c94fa3 [309/310] xfs: fallocate free space into a file
config: mips-randconfig-r004-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 2c6448cdc2f68f8c28fd0bd9404182b81306e6e6)
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
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/commit/?id=e17e75a18c97e1f807f4e82707349ffa38c94fa3
git remote add djwong-xfs https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
git fetch --no-tags djwong-xfs defrag-freespace
git checkout e17e75a18c97e1f807f4e82707349ffa38c94fa3
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
fs/xfs/libxfs/xfs_bmap.c:6593:16: warning: variable 'rtxlen_in' set but not used [-Wunused-but-set-variable]
xfs_extlen_t rtxlen_in, rtxlen_out;
^
>> fs/xfs/libxfs/xfs_bmap.c:6611:25: warning: variable 'rtxlen_out' is uninitialized when used here [-Wuninitialized]
mval->br_blockcount = rtxlen_out * mp->m_sb.sb_rextsize;
^~~~~~~~~~
fs/xfs/libxfs/xfs_bmap.c:6593:37: note: initialize the variable 'rtxlen_out' to silence this warning
xfs_extlen_t rtxlen_in, rtxlen_out;
^
= 0
>> fs/xfs/libxfs/xfs_bmap.c:6605:7: warning: variable 'rtx_out' is uninitialized when used here [-Wuninitialized]
if (rtx_out == NULLRTBLOCK)
^~~~~~~
fs/xfs/libxfs/xfs_bmap.c:6592:32: note: initialize the variable 'rtx_out' to silence this warning
xfs_rtblock_t rtx_in, rtx_out;
^
= 0
3 warnings generated.
vim +/rtxlen_out +6611 fs/xfs/libxfs/xfs_bmap.c
6541
6542 /*
6543 * Given a file and a free physical extent, map it into the file at the same
6544 * offset if the file were a sparse image of the physical device. Set @mval to
6545 * whatever mapping we added to the file.
6546 */
6547 int
6548 xfs_bmapi_freesp(
6549 struct xfs_trans **tpp,
6550 struct xfs_inode *ip,
6551 xfs_fsblock_t fsbno,
6552 xfs_extlen_t len,
6553 struct xfs_bmbt_irec *mval)
6554 {
6555 struct xfs_bmbt_irec irec;
6556 struct xfs_mount *mp = ip->i_mount;
6557 xfs_fileoff_t startoff;
6558 bool isrt = XFS_IS_REALTIME_INODE(ip);
6559 int nimaps;
6560 int error;
6561
6562 trace_xfs_bmapi_freesp(ip, fsbno, len);
6563
6564 error = xfs_iext_count_may_overflow(ip, XFS_DATA_FORK,
6565 XFS_IEXT_ADD_NOSPLIT_CNT);
6566 if (error)
6567 return error;
6568
6569 if (isrt)
6570 startoff = fsbno;
6571 else
6572 startoff = xfs_fsblock_to_fileoff(mp, fsbno);
6573
6574 /* Make sure the entire range is a hole. */
6575 nimaps = 1;
6576 error = xfs_bmapi_read(ip, startoff, len, &irec, &nimaps, 0);
6577 if (error)
6578 return error;
6579
6580 if (irec.br_startoff != startoff ||
6581 irec.br_startblock != HOLESTARTBLOCK ||
6582 irec.br_blockcount < len)
6583 return -EINVAL;
6584
6585 /*
6586 * Allocate the physical extent. We should not have dropped the lock
6587 * since the scan of the free space metadata, so this should work,
6588 * though the length may be adjusted to play nicely with metadata space
6589 * reservations.
6590 */
6591 if (isrt) {
6592 xfs_rtblock_t rtx_in, rtx_out;
> 6593 xfs_extlen_t rtxlen_in, rtxlen_out;
6594 uint32_t mod;
6595
6596 rtx_in = div_u64_rem(fsbno, mp->m_sb.sb_rextsize, &mod);
6597 ASSERT(mod == 0);
6598 rtxlen_in = len / mp->m_sb.sb_rextsize;
6599 ASSERT(len % mp->m_sb.sb_rextsize == 0);
6600
6601 error = xfs_rtallocate_extent(*tpp, rtx_in, 1, rtxlen_in,
6602 &rtxlen_out, 0, 1, &rtx_out);
6603 if (error)
6604 return error;
> 6605 if (rtx_out == NULLRTBLOCK)
6606 return -ENOSPC;
6607 if (rtx_out != rtx_in) {
6608 ASSERT(0);
6609 return -EFSCORRUPTED;
6610 }
> 6611 mval->br_blockcount = rtxlen_out * mp->m_sb.sb_rextsize;
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (29750 bytes)
Powered by blists - more mailing lists