Content-Type: multipart/mixed; boundary="===============0302111583814167466==" MIME-Version: 1.0 From: Darrick J. Wong To: kbuild-all@lists.01.org Subject: Re: [kbuild] [djwong-xfs:vectorized-scrub 154/283] fs/xfs/libxfs/xfs_inode_buf.c:477:27: sparse: sparse: dubious: x & !y Date: Fri, 26 Mar 2021 12:11:30 -0700 Message-ID: <20210326191130.GO1670408@magnolia> In-Reply-To: <20210326084227.GY1667@kadam> List-Id: --===============0302111583814167466== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Fri, Mar 26, 2021 at 11:42:27AM +0300, Dan Carpenter wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.= git vectorized-scrub > head: 13a296999ea49dd4cb16cab75c3aef5e691ed124 > commit: 15b9a9194ac8364474c84f2077b2a1ab2c549444 [154/283] xfs: enforce m= etadata inode flag > config: x86_64-randconfig-s022-20210325 (attached as .config) > compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 > reproduce: > # apt-get install sparse > # sparse version: v0.6.3-277-gc089cd2d-dirty > # https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linu= x.git/commit/?id=3D15b9a9194ac8364474c84f2077b2a1ab2c549444 = > git remote add djwong-xfs https://git.kernel.org/pub/scm/linux/ke= rnel/git/djwong/xfs-linux.git = > git fetch --no-tags djwong-xfs vectorized-scrub > git checkout 15b9a9194ac8364474c84f2077b2a1ab2c549444 > # save the attached .config to linux build tree > make W=3D1 C=3D1 CF=3D'-fdiagnostic-prefix -D__CHECK_ENDIAN__' AR= CH=3Dx86_64 = > = > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot > = > 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 > = > 15b9a9194ac836 Darrick J. Wong 2021-01-05 428 xfs_failaddr_t > 15b9a9194ac836 Darrick J. Wong 2021-01-05 429 xfs_dinode_verify_metafla= g( > 15b9a9194ac836 Darrick J. Wong 2021-01-05 430 struct xfs_mount *mp, > 15b9a9194ac836 Darrick J. Wong 2021-01-05 431 struct xfs_dinode *dip, > 15b9a9194ac836 Darrick J. Wong 2021-01-05 432 uint16_t mode, > 15b9a9194ac836 Darrick J. Wong 2021-01-05 433 uint16_t flags, > 15b9a9194ac836 Darrick J. Wong 2021-01-05 434 uint64_t flags2) > 15b9a9194ac836 Darrick J. Wong 2021-01-05 435 { > 15b9a9194ac836 Darrick J. Wong 2021-01-05 436 if (!xfs_sb_version_hasm= etadir(&mp->m_sb)) > 15b9a9194ac836 Darrick J. Wong 2021-01-05 437 return __this_address; > 15b9a9194ac836 Darrick J. Wong 2021-01-05 438 = > 15b9a9194ac836 Darrick J. Wong 2021-01-05 439 /* V5 filesystem only */ > 15b9a9194ac836 Darrick J. Wong 2021-01-05 440 if (dip->di_version < 3) > 15b9a9194ac836 Darrick J. Wong 2021-01-05 441 return __this_address; > 15b9a9194ac836 Darrick J. Wong 2021-01-05 442 = > 15b9a9194ac836 Darrick J. Wong 2021-01-05 443 /* V3 inode fields that = are always zero */ > 15b9a9194ac836 Darrick J. Wong 2021-01-05 444 if (dip->di_flushiter ||= dip->di_onlink) > 15b9a9194ac836 Darrick J. Wong 2021-01-05 445 return __this_address; > 15b9a9194ac836 Darrick J. Wong 2021-01-05 446 = > 15b9a9194ac836 Darrick J. Wong 2021-01-05 447 /* Metadata files can on= ly be directories or regular files */ > 15b9a9194ac836 Darrick J. Wong 2021-01-05 448 if (!S_ISDIR(mode) && !S= _ISREG(mode)) > 15b9a9194ac836 Darrick J. Wong 2021-01-05 449 return __this_address; > 15b9a9194ac836 Darrick J. Wong 2021-01-05 450 = > 15b9a9194ac836 Darrick J. Wong 2021-01-05 451 /* They must have zero a= ccess permissions */ > 15b9a9194ac836 Darrick J. Wong 2021-01-05 452 if (mode & 0777) > 15b9a9194ac836 Darrick J. Wong 2021-01-05 453 return __this_address; > 15b9a9194ac836 Darrick J. Wong 2021-01-05 454 = > 15b9a9194ac836 Darrick J. Wong 2021-01-05 455 /* DMAPI event and state= masks are zero */ > 15b9a9194ac836 Darrick J. Wong 2021-01-05 456 if (dip->di_dmevmask || = dip->di_dmstate) > 15b9a9194ac836 Darrick J. Wong 2021-01-05 457 return __this_address; > 15b9a9194ac836 Darrick J. Wong 2021-01-05 458 = > 15b9a9194ac836 Darrick J. Wong 2021-01-05 459 /* User, group, and proj= ect IDs must be zero */ > 15b9a9194ac836 Darrick J. Wong 2021-01-05 460 if (dip->di_uid || dip->= di_gid || > 15b9a9194ac836 Darrick J. Wong 2021-01-05 461 dip->di_projid_lo ||= dip->di_projid_hi) > 15b9a9194ac836 Darrick J. Wong 2021-01-05 462 return __this_address; > 15b9a9194ac836 Darrick J. Wong 2021-01-05 463 = > 15b9a9194ac836 Darrick J. Wong 2021-01-05 464 /* Immutable, sync, noat= ime, nodump, and nodefrag flags must be set */ > 15b9a9194ac836 Darrick J. Wong 2021-01-05 465 if (!(flags & XFS_DIFLAG= _IMMUTABLE)) > 15b9a9194ac836 Darrick J. Wong 2021-01-05 466 return __this_address; > 15b9a9194ac836 Darrick J. Wong 2021-01-05 467 if (!(flags & XFS_DIFLAG= _SYNC)) > 15b9a9194ac836 Darrick J. Wong 2021-01-05 468 return __this_address; > 15b9a9194ac836 Darrick J. Wong 2021-01-05 469 if (!(flags & XFS_DIFLAG= _NOATIME)) > 15b9a9194ac836 Darrick J. Wong 2021-01-05 470 return __this_address; > 15b9a9194ac836 Darrick J. Wong 2021-01-05 471 if (!(flags & XFS_DIFLAG= _NODUMP)) > 15b9a9194ac836 Darrick J. Wong 2021-01-05 472 return __this_address; > 15b9a9194ac836 Darrick J. Wong 2021-01-05 473 if (!(flags & XFS_DIFLAG= _NODEFRAG)) > 15b9a9194ac836 Darrick J. Wong 2021-01-05 474 return __this_address; > 15b9a9194ac836 Darrick J. Wong 2021-01-05 475 = > 15b9a9194ac836 Darrick J. Wong 2021-01-05 476 /* Directories must have= nosymlinks flags set */ > 15b9a9194ac836 Darrick J. Wong 2021-01-05 @477 if (S_ISDIR(mode) & !(fl= ags & XFS_DIFLAG_NOSYMLINKS)) > = > Presumably this S_ISDIR() return bool so both && and & work. I sometimes > see people using & instead of && and I don't normally ask about it > if both work fine. I've always just assumed that & is faster. :P Nah, that's a slipup on my part. That really should be logical-and, not bitwise-and: if (S_ISDIR(mode) && !(flags & XFS_DIFLAG_NOSYMLINKS)) Thank you for catching it! --D > 15b9a9194ac836 Darrick J. Wong 2021-01-05 478 return __this_address; > 15b9a9194ac836 Darrick J. Wong 2021-01-05 479 = > 15b9a9194ac836 Darrick J. Wong 2021-01-05 480 /* dax flags2 must not b= e set */ > 15b9a9194ac836 Darrick J. Wong 2021-01-05 481 if (flags2 & XFS_DIFLAG2= _DAX) > 15b9a9194ac836 Darrick J. Wong 2021-01-05 482 return __this_address; > 15b9a9194ac836 Darrick J. Wong 2021-01-05 483 = > 15b9a9194ac836 Darrick J. Wong 2021-01-05 484 return NULL; > 15b9a9194ac836 Darrick J. Wong 2021-01-05 485 } > = > --- > 0-DAY CI Kernel Test Service, Intel Corporation > https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org = > _______________________________________________ > kbuild mailing list -- kbuild(a)lists.01.org > To unsubscribe send an email to kbuild-leave(a)lists.01.org --===============0302111583814167466==--