netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [nf:master 7/7] net/netfilter/nf_tables_api.c:920:15: warning: converting the enum constant to a boolean
@ 2021-03-02 13:17 kernel test robot
  2021-03-02 15:38 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2021-03-02 13:17 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: kbuild-all, clang-built-linux, netfilter-devel, coreteam

[-- Attachment #1: Type: text/plain, Size: 3271 bytes --]

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@intel.com>

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@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32895 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [nf:master 7/7] net/netfilter/nf_tables_api.c:920:15: warning: converting the enum constant to a boolean
  2021-03-02 13:17 [nf:master 7/7] net/netfilter/nf_tables_api.c:920:15: warning: converting the enum constant to a boolean kernel test robot
@ 2021-03-02 15:38 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2021-03-02 15:38 UTC (permalink / raw)
  To: kernel test robot
  Cc: kbuild-all, clang-built-linux, netfilter-devel, coreteam

On Tue, Mar 02, 2021 at 09:17:37PM +0800, kernel test robot wrote:
> 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@intel.com>
> 
> 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)) ||
>                         ^

Ouch. Fixed.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-02 23:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-02 13:17 [nf:master 7/7] net/netfilter/nf_tables_api.c:920:15: warning: converting the enum constant to a boolean kernel test robot
2021-03-02 15:38 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).