lkml.org 
[lkml]   [2021]   [Oct]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[allisonhenderson-xfs-work:pptrs_restart129 22/37] fs/xfs/libxfs/xfs_attr.c:663:72: warning: bitwise comparison always evaluates to true
tree:   https://github.com/allisonhenderson/xfs_work.git pptrs_restart129
head: f0a0e96bd7e03c467041931dc1b9663111f1d365
commit: 520f2aa27a38ee5bd88e773638e380117646889f [22/37] xfs: add parent pointer support to attribute code
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc-linux-gcc (GCC) 11.2.0
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/520f2aa27a38ee5bd88e773638e380117646889f
git remote add allisonhenderson-xfs-work https://github.com/allisonhenderson/xfs_work.git
git fetch --no-tags allisonhenderson-xfs-work pptrs_restart129
git checkout 520f2aa27a38ee5bd88e773638e380117646889f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=powerpc

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

All warnings (new ones prefixed by >>):

fs/xfs/libxfs/xfs_attr.c: In function 'xfs_attr_set':
>> fs/xfs/libxfs/xfs_attr.c:663:72: warning: bitwise comparison always evaluates to true [-Wtautological-compare]
663 | rsvd = ((args->attr_filter & XFS_ATTR_ROOT) | XFS_ATTR_PARENT) != 0;
| ^~


vim +663 fs/xfs/libxfs/xfs_attr.c

645
646 /*
647 * Note: If args->value is NULL the attribute will be removed, just like the
648 * Linux ->setattr API.
649 */
650 int
651 xfs_attr_set(
652 struct xfs_da_args *args)
653 {
654 struct xfs_inode *dp = args->dp;
655 struct xfs_mount *mp = dp->i_mount;
656 struct xfs_trans_res tres;
657 bool rsvd;
658 int error, local;
659 int rmt_blks = 0;
660 unsigned int total;
661 int delayed = xfs_has_larp(mp);
662
> 663 rsvd = ((args->attr_filter & XFS_ATTR_ROOT) | XFS_ATTR_PARENT) != 0;
664
665 if (xfs_is_shutdown(dp->i_mount))
666 return -EIO;
667
668 error = xfs_qm_dqattach(dp);
669 if (error)
670 return error;
671
672 args->geo = mp->m_attr_geo;
673 args->whichfork = XFS_ATTR_FORK;
674 args->hashval = xfs_da_hashname(args->name, args->namelen);
675
676 /*
677 * We have no control over the attribute names that userspace passes us
678 * to remove, so we have to allow the name lookup prior to attribute
679 * removal to fail as well.
680 */
681 args->op_flags = XFS_DA_OP_OKNOENT;
682
683 if (args->value) {
684 XFS_STATS_INC(mp, xs_attr_set);
685
686 args->op_flags |= XFS_DA_OP_ADDNAME;
687 args->total = xfs_attr_calc_size(args, &local);
688
689 /*
690 * If the inode doesn't have an attribute fork, add one.
691 * (inode must not be locked when we call this routine)
692 */
693 if (XFS_IFORK_Q(dp) == 0) {
694 int sf_size = sizeof(struct xfs_attr_sf_hdr) +
695 xfs_attr_sf_entsize_byname(args->namelen,
696 args->valuelen);
697
698 error = xfs_bmap_add_attrfork(dp, sf_size, rsvd);
699 if (error)
700 return error;
701 }
702
703 tres.tr_logres = M_RES(mp)->tr_attrsetm.tr_logres +
704 M_RES(mp)->tr_attrsetrt.tr_logres *
705 args->total;
706 tres.tr_logcount = XFS_ATTRSET_LOG_COUNT;
707 tres.tr_logflags = XFS_TRANS_PERM_LOG_RES;
708 total = args->total;
709
710 if (!local)
711 rmt_blks = xfs_attr3_rmt_blocks(mp, args->valuelen);
712 } else {
713 XFS_STATS_INC(mp, xs_attr_remove);
714
715 tres = M_RES(mp)->tr_attrrm;
716 total = XFS_ATTRRM_SPACE_RES(mp);
717 rmt_blks = xfs_attr3_rmt_blocks(mp, XFS_XATTR_SIZE_MAX);
718 }
719
720 if (delayed) {
721 error = xfs_attr_use_log_assist(mp);
722 if (error)
723 return error;
724 }
725
726 /*
727 * Root fork attributes can use reserved data blocks for this
728 * operation if necessary
729 */
730 error = xfs_trans_alloc_inode(dp, &tres, total, 0, rsvd, &args->trans);
731 if (error)
732 goto drop_incompat;
733
734 if (args->value || xfs_inode_hasattr(dp)) {
735 error = xfs_iext_count_may_overflow(dp, XFS_ATTR_FORK,
736 XFS_IEXT_ATTR_MANIP_CNT(rmt_blks));
737 if (error)
738 goto out_trans_cancel;
739 }
740
741 error = xfs_attr_lookup(args);
742 if (args->value) {
743 if (error == -EEXIST && (args->attr_flags & XATTR_CREATE))
744 goto out_trans_cancel;
745 if (error == -ENOATTR && (args->attr_flags & XATTR_REPLACE))
746 goto out_trans_cancel;
747 if (error != -ENOATTR && error != -EEXIST)
748 goto out_trans_cancel;
749
750 error = xfs_attr_set_deferred(args);
751 if (error)
752 goto out_trans_cancel;
753
754 /* shortform attribute has already been committed */
755 if (!args->trans)
756 goto out_unlock;
757 } else {
758 if (error != -EEXIST)
759 goto out_trans_cancel;
760
761 error = xfs_attr_remove_deferred(args);
762 if (error)
763 goto out_trans_cancel;
764 }
765
766 /*
767 * If this is a synchronous mount, make sure that the
768 * transaction goes to disk before returning to the user.
769 */
770 if (xfs_has_wsync(mp))
771 xfs_trans_set_sync(args->trans);
772
773 if (!(args->op_flags & XFS_DA_OP_NOTIME))
774 xfs_trans_ichgtime(args->trans, dp, XFS_ICHGTIME_CHG);
775
776 /*
777 * Commit the last in the sequence of transactions.
778 */
779 xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE);
780 error = xfs_trans_commit(args->trans);
781 out_unlock:
782 xfs_iunlock(dp, XFS_ILOCK_EXCL);
783 drop_incompat:
784 if (delayed)
785 xlog_drop_incompat_feat(mp->m_log);
786 return error;
787
788 out_trans_cancel:
789 if (args->trans)
790 xfs_trans_cancel(args->trans);
791 goto out_unlock;
792 }
793

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2021-10-14 13:24    [W:0.067 / U:6.484 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site