tree:
https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
reserve-rt-metadata-space
head: 1cc2dc6cc907783eca0a0665605e0a9e7e8d9bfd
commit: b24243a5282075e311566babe1af7e60e1669f64 [180/219] xfs: enforce metadata inode
flag
config: h8300-randconfig-s031-20210209 (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0
reproduce:
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-215-g0fb77bb6-dirty
#
https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/comm...
git remote add djwong-xfs
https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
git fetch --no-tags djwong-xfs reserve-rt-metadata-space
git checkout b24243a5282075e311566babe1af7e60e1669f64
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=h8300
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <rong.a.chen(a)intel.com>
"sparse warnings: (new ones prefixed by >>)"
> fs/xfs/libxfs/xfs_inode_buf.c:477:27: sparse: sparse: dubious: x
& !y
vim +477 fs/xfs/libxfs/xfs_inode_buf.c
339e1a3fcdd199 Eric Sandeen 2018-09-29 423
b24243a5282075 Darrick J. Wong 2021-01-05 424 /*
b24243a5282075 Darrick J. Wong 2021-01-05 425 * Validate all the picky requirements we
have for a file that claims to be
b24243a5282075 Darrick J. Wong 2021-01-05 426 * filesystem metadata.
b24243a5282075 Darrick J. Wong 2021-01-05 427 */
b24243a5282075 Darrick J. Wong 2021-01-05 428 xfs_failaddr_t
b24243a5282075 Darrick J. Wong 2021-01-05 429 xfs_dinode_verify_metaflag(
b24243a5282075 Darrick J. Wong 2021-01-05 430 struct xfs_mount *mp,
b24243a5282075 Darrick J. Wong 2021-01-05 431 struct xfs_dinode *dip,
b24243a5282075 Darrick J. Wong 2021-01-05 432 uint16_t mode,
b24243a5282075 Darrick J. Wong 2021-01-05 433 uint16_t flags,
b24243a5282075 Darrick J. Wong 2021-01-05 434 uint64_t flags2)
b24243a5282075 Darrick J. Wong 2021-01-05 435 {
b24243a5282075 Darrick J. Wong 2021-01-05 436 if
(!xfs_sb_version_hasmetadir(&mp->m_sb))
b24243a5282075 Darrick J. Wong 2021-01-05 437 return __this_address;
b24243a5282075 Darrick J. Wong 2021-01-05 438
b24243a5282075 Darrick J. Wong 2021-01-05 439 /* V5 filesystem only */
b24243a5282075 Darrick J. Wong 2021-01-05 440 if (dip->di_version < 3)
b24243a5282075 Darrick J. Wong 2021-01-05 441 return __this_address;
b24243a5282075 Darrick J. Wong 2021-01-05 442
b24243a5282075 Darrick J. Wong 2021-01-05 443 /* V3 inode fields that are always zero
*/
b24243a5282075 Darrick J. Wong 2021-01-05 444 if (dip->di_flushiter ||
dip->di_onlink)
b24243a5282075 Darrick J. Wong 2021-01-05 445 return __this_address;
b24243a5282075 Darrick J. Wong 2021-01-05 446
b24243a5282075 Darrick J. Wong 2021-01-05 447 /* Metadata files can only be directories
or regular files */
b24243a5282075 Darrick J. Wong 2021-01-05 448 if (!S_ISDIR(mode) &&
!S_ISREG(mode))
b24243a5282075 Darrick J. Wong 2021-01-05 449 return __this_address;
b24243a5282075 Darrick J. Wong 2021-01-05 450
b24243a5282075 Darrick J. Wong 2021-01-05 451 /* They must have zero access permissions
*/
b24243a5282075 Darrick J. Wong 2021-01-05 452 if (mode & 0777)
b24243a5282075 Darrick J. Wong 2021-01-05 453 return __this_address;
b24243a5282075 Darrick J. Wong 2021-01-05 454
b24243a5282075 Darrick J. Wong 2021-01-05 455 /* DMAPI event and state masks are zero
*/
b24243a5282075 Darrick J. Wong 2021-01-05 456 if (dip->di_dmevmask ||
dip->di_dmstate)
b24243a5282075 Darrick J. Wong 2021-01-05 457 return __this_address;
b24243a5282075 Darrick J. Wong 2021-01-05 458
b24243a5282075 Darrick J. Wong 2021-01-05 459 /* User, group, and project IDs must be
zero */
b24243a5282075 Darrick J. Wong 2021-01-05 460 if (dip->di_uid || dip->di_gid ||
b24243a5282075 Darrick J. Wong 2021-01-05 461 dip->di_projid_lo ||
dip->di_projid_hi)
b24243a5282075 Darrick J. Wong 2021-01-05 462 return __this_address;
b24243a5282075 Darrick J. Wong 2021-01-05 463
b24243a5282075 Darrick J. Wong 2021-01-05 464 /* Immutable, sync, noatime, nodump, and
nodefrag flags must be set */
b24243a5282075 Darrick J. Wong 2021-01-05 465 if (!(flags & XFS_DIFLAG_IMMUTABLE))
b24243a5282075 Darrick J. Wong 2021-01-05 466 return __this_address;
b24243a5282075 Darrick J. Wong 2021-01-05 467 if (!(flags & XFS_DIFLAG_SYNC))
b24243a5282075 Darrick J. Wong 2021-01-05 468 return __this_address;
b24243a5282075 Darrick J. Wong 2021-01-05 469 if (!(flags & XFS_DIFLAG_NOATIME))
b24243a5282075 Darrick J. Wong 2021-01-05 470 return __this_address;
b24243a5282075 Darrick J. Wong 2021-01-05 471 if (!(flags & XFS_DIFLAG_NODUMP))
b24243a5282075 Darrick J. Wong 2021-01-05 472 return __this_address;
b24243a5282075 Darrick J. Wong 2021-01-05 473 if (!(flags & XFS_DIFLAG_NODEFRAG))
b24243a5282075 Darrick J. Wong 2021-01-05 474 return __this_address;
b24243a5282075 Darrick J. Wong 2021-01-05 475
b24243a5282075 Darrick J. Wong 2021-01-05 476 /* Directories must have nosymlinks flags
set */
b24243a5282075 Darrick J. Wong 2021-01-05 @477 if (S_ISDIR(mode) & !(flags &
XFS_DIFLAG_NOSYMLINKS))
b24243a5282075 Darrick J. Wong 2021-01-05 478 return __this_address;
b24243a5282075 Darrick J. Wong 2021-01-05 479
b24243a5282075 Darrick J. Wong 2021-01-05 480 /* dax flags2 must not be set */
b24243a5282075 Darrick J. Wong 2021-01-05 481 if (flags2 & XFS_DIFLAG2_DAX)
b24243a5282075 Darrick J. Wong 2021-01-05 482 return __this_address;
b24243a5282075 Darrick J. Wong 2021-01-05 483
b24243a5282075 Darrick J. Wong 2021-01-05 484 return NULL;
b24243a5282075 Darrick J. Wong 2021-01-05 485 }
b24243a5282075 Darrick J. Wong 2021-01-05 486
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave(a)lists.01.org