[nf:master 7/7] net/netfilter/nf_tables_api.c:920:15: warning: converting the enum constant to a boolean

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf.git master
head:   64d075d0d3770d761018500d59dbca37b1867017
commit: 64d075d0d3770d761018500d59dbca37b1867017 [7/7] netfilter: nftables: disallow updates on table ownership
config: powerpc64-randconfig-r022-20210302 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 5de09ef02e24d234d9fc0cd1c6dfe18a1bb784b0)
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 powerpc64 cross compiling tool for clang build
        # apt-get install binutils-powerpc64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf.git/commit/?id=64d075d0d3770d761018500d59dbca37b1867017
        git remote add nf https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf.git
        git fetch --no-tags nf master
        git checkout 64d075d0d3770d761018500d59dbca37b1867017
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64 

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

All warnings (new ones prefixed by >>):

>> net/netfilter/nf_tables_api.c:920:15: warning: converting the enum constant to a boolean [-Wint-in-bool-context]
                !(flags && NFT_TABLE_F_OWNER)) ||
                        ^
   1 warning generated.


vim +920 net/netfilter/nf_tables_api.c

   902	
   903	static int nf_tables_updtable(struct nft_ctx *ctx)
   904	{
   905		struct nft_trans *trans;
   906		u32 flags;
   907		int ret = 0;
   908	
   909		if (!ctx->nla[NFTA_TABLE_FLAGS])
   910			return 0;
   911	
   912		flags = ntohl(nla_get_be32(ctx->nla[NFTA_TABLE_FLAGS]));
   913		if (flags & ~NFT_TABLE_F_MASK)
   914			return -EOPNOTSUPP;
   915	
   916		if (flags == ctx->table->flags)
   917			return 0;
   918	
   919		if ((nft_table_has_owner(ctx->table) &&
 > 920		     !(flags && NFT_TABLE_F_OWNER)) ||
   921		    (!nft_table_has_owner(ctx->table) &&
   922		     flags & NFT_TABLE_F_OWNER))
   923			return -EOPNOTSUPP;
   924	
   925		trans = nft_trans_alloc(ctx, NFT_MSG_NEWTABLE,
   926					sizeof(struct nft_trans_table));
   927		if (trans == NULL)
   928			return -ENOMEM;
   929	
   930		if ((flags & NFT_TABLE_F_DORMANT) &&
   931		    !(ctx->table->flags & NFT_TABLE_F_DORMANT)) {
   932			nft_trans_table_enable(trans) = false;
   933		} else if (!(flags & NFT_TABLE_F_DORMANT) &&
   934			   ctx->table->flags & NFT_TABLE_F_DORMANT) {
   935			ctx->table->flags &= ~NFT_TABLE_F_DORMANT;
   936			ret = nf_tables_table_enable(ctx->net, ctx->table);
   937			if (ret >= 0)
   938				nft_trans_table_enable(trans) = true;
   939			else
   940				ctx->table->flags |= NFT_TABLE_F_DORMANT;
   941		}
   942		if (ret < 0)
   943			goto err;
   944	
   945		nft_trans_table_update(trans) = true;
   946		list_add_tail(&trans->list, &ctx->net->nft.commit_list);
   947		return 0;
   948	err:
   949		nft_trans_destroy(trans);
   950		return ret;
   951	}
   952	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux