[allisonhenderson-xfs_work:delayed_attrs_v24_extended 16/27] fs/xfs/libxfs/xfs_attr.c:663:72: warning: bitwise comparison always evaluates to true

From: kernel test robot
Date: Tue Aug 24 2021 - 20:12:26 EST


tree: https://github.com/allisonhenderson/xfs_work.git delayed_attrs_v24_extended
head: 65b46be2f965591671441cfd63f02f38befbec24
commit: 2cf33485e4ee79d494d2bd24d7bf6f86ada0ce9e [16/27] xfs: add parent pointer support to attribute code
config: arc-buildonly-randconfig-r006-20210824 (attached as .config)
compiler: arceb-elf-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/2cf33485e4ee79d494d2bd24d7bf6f86ada0ce9e
git remote add allisonhenderson-xfs_work https://github.com/allisonhenderson/xfs_work.git
git fetch --no-tags allisonhenderson-xfs_work delayed_attrs_v24_extended
git checkout 2cf33485e4ee79d494d2bd24d7bf6f86ada0ce9e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arc

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

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;
| ^~
In file included from include/linux/string.h:5,
from include/linux/uuid.h:12,
from fs/xfs/xfs_linux.h:10,
from fs/xfs/xfs.h:22,
from fs/xfs/libxfs/xfs_attr.c:6:
fs/xfs/libxfs/xfs_attr.c: In function 'xfs_attr_set_iter':
include/linux/compiler.h:56:26: warning: this statement may fall through [-Wimplicit-fallthrough=]
56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
| ^
fs/xfs/libxfs/xfs_attr.c:437:17: note: in expansion of macro 'if'
437 | if (!xfs_has_larp(mp)) {
| ^~
fs/xfs/libxfs/xfs_attr.c:452:9: note: here
452 | case XFS_DAS_FLIP_LFLAG:
| ^~~~
In file included from include/linux/string.h:5,
from include/linux/uuid.h:12,
from fs/xfs/xfs_linux.h:10,
from fs/xfs/xfs.h:22,
from fs/xfs/libxfs/xfs_attr.c:6:
include/linux/compiler.h:56:26: warning: this statement may fall through [-Wimplicit-fallthrough=]
56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
| ^
fs/xfs/libxfs/xfs_attr.c:555:17: note: in expansion of macro 'if'
555 | if (!xfs_has_larp(mp)) {
| ^~
fs/xfs/libxfs/xfs_attr.c:570:9: note: here
570 | case XFS_DAS_FLIP_NFLAG:
| ^~~~


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@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip