[nf-next:master 7/27] net/netfilter/nf_tables_offload.c:316 nft_flow_offload_chain() warn: always true condition '(policy != -1) => (0-255 != (-1))'

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

 



tree:   https://kernel.googlesource.com/pub/scm/linux/kernel/git/pablo/nf-next.git master
head:   0d32e7048d927418300b9f5415ca546e44621ef1
commit: 8fc618c52d163baa7ae020e4c92474159b6006b7 [7/27] netfilter: nf_tables_offload: refactor the nft_flow_offload_chain function

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

New smatch warnings:
net/netfilter/nf_tables_offload.c:316 nft_flow_offload_chain() warn: always true condition '(policy != -1) => (0-255 != (-1))'

Old smatch warnings:
include/linux/compiler.h:226 __write_once_size() warn: potential memory corrupting cast 8 vs 4 bytes

vim +316 net/netfilter/nf_tables_offload.c

   296	
   297	static int nft_flow_offload_chain(struct nft_chain *chain,
   298					  u8 *ppolicy,
   299					  enum flow_block_command cmd)
   300	{
   301		struct nft_base_chain *basechain;
   302		struct net_device *dev;
   303		u8 policy;
   304	
   305		if (!nft_is_base_chain(chain))
   306			return -EOPNOTSUPP;
   307	
   308		basechain = nft_base_chain(chain);
   309		dev = basechain->ops.dev;
   310		if (!dev)
   311			return -EOPNOTSUPP;
   312	
   313		policy = ppolicy ? *ppolicy : basechain->policy;
   314	
   315		/* Only default policy to accept is supported for now. */
 > 316		if (cmd == FLOW_BLOCK_BIND && policy != -1 && policy != NF_ACCEPT)
   317			return -EOPNOTSUPP;
   318	
   319		if (dev->netdev_ops->ndo_setup_tc)
   320			return nft_block_offload_cmd(basechain, dev, cmd);
   321		else
   322			return nft_indr_block_offload_cmd(basechain, dev, cmd);
   323	}
   324	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation



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

  Powered by Linux