Re: [PATCH nf-next v7 5/8] netfilter:nf_flow_table_core: Support bridge family flow offload

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

 



Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on nf-next/master]

url:    https://github.com/0day-ci/linux/commits/wenxu-ucloud-cn/netfilter-Support-the-bridge-family-in-flow-table/20190830-172019
base:   https://kernel.googlesource.com/pub/scm/linux/kernel/git/pablo/nf-next.git master
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.4.0-11) 7.4.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

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

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   In file included from net//netfilter/nf_flow_table_core.c:9:0:
   net//netfilter/nf_flow_table_core.c: In function 'flow_offload_fill_dir':
>> include/net/ip6_route.h:322:26: warning: 'dst' may be used uninitialized in this function [-Wmaybe-uninitialized]
     idev = __in6_dev_get(dst->dev);
                          ~~~^~~~~
   net//netfilter/nf_flow_table_core.c:62:20: note: 'dst' was declared here
     struct dst_entry *dst;
                       ^~~
>> net//netfilter/nf_flow_table_core.c:83:22: warning: 'dst_port' may be used uninitialized in this function [-Wmaybe-uninitialized]
       ft->mtu = dst_port->dev->mtu;
                 ~~~~~~~~^~~~~
--
   In file included from net/netfilter/nf_flow_table_core.c:9:0:
   net/netfilter/nf_flow_table_core.c: In function 'flow_offload_fill_dir':
>> include/net/ip6_route.h:322:26: warning: 'dst' may be used uninitialized in this function [-Wmaybe-uninitialized]
     idev = __in6_dev_get(dst->dev);
                          ~~~^~~~~
   net/netfilter/nf_flow_table_core.c:62:20: note: 'dst' was declared here
     struct dst_entry *dst;
                       ^~~
   net/netfilter/nf_flow_table_core.c:83:22: warning: 'dst_port' may be used uninitialized in this function [-Wmaybe-uninitialized]
       ft->mtu = dst_port->dev->mtu;
                 ~~~~~~~~^~~~~

vim +/dst_port +83 net//netfilter/nf_flow_table_core.c

   > 9	#include <net/ip6_route.h>
    10	#include <net/netfilter/nf_tables.h>
    11	#include <net/netfilter/nf_flow_table.h>
    12	#include <net/netfilter/nf_conntrack.h>
    13	#include <net/netfilter/nf_conntrack_core.h>
    14	#include <net/netfilter/nf_conntrack_tuple.h>
    15	
    16	struct flow_offload_entry {
    17		struct flow_offload	flow;
    18		struct nf_conn		*ct;
    19		struct rcu_head		rcu_head;
    20	};
    21	
    22	static DEFINE_MUTEX(flowtable_lock);
    23	static LIST_HEAD(flowtables);
    24	
    25	static struct dst_entry *
    26	flow_offload_fill_inet_dst(struct flow_offload_tuple *ft,
    27				   struct nf_flow_route *route,
    28				   enum flow_offload_tuple_dir dir)
    29	{
    30		struct dst_entry *other_dst = route->tuple[!dir].dst;
    31		struct dst_entry *dst = route->tuple[dir].dst;
    32	
    33		ft->iifidx = other_dst->dev->ifindex;
    34		ft->dst.dst_cache = dst;
    35	
    36		return dst;
    37	}
    38	
    39	static struct dst_br_port *
    40	flow_offload_fill_bridge_dst(struct flow_offload_tuple *ft,
    41				     struct nf_flow_forward *forward,
    42				     enum flow_offload_tuple_dir dir)
    43	{
    44		struct dst_br_port other_dst_port = forward->tuple[!dir].dst_port;
    45		struct dst_br_port dst_port = forward->tuple[dir].dst_port;
    46	
    47		ft->iifidx = other_dst_port.dev->ifindex;
    48		ft->dst.dst_port = dst_port;
    49		ft->vlan_tag = forward->tuple[dir].vlan_tag;
    50	
    51		return &ft->dst.dst_port;
    52	}
    53	
    54	static void
    55	flow_offload_fill_dir(struct flow_offload *flow, struct nf_conn *ct,
    56			      struct nf_flow_dst *flow_dst,
    57			      enum flow_offload_tuple_dir dir)
    58	{
    59		struct flow_offload_tuple *ft = &flow->tuplehash[dir].tuple;
    60		struct nf_conntrack_tuple *ctt = &ct->tuplehash[dir].tuple;
    61		struct dst_br_port *dst_port;
    62		struct dst_entry *dst;
    63	
    64		switch (flow_dst->type) {
    65		case FLOW_OFFLOAD_TYPE_INET:
    66			dst = flow_offload_fill_inet_dst(ft, &flow_dst->route, dir);
    67			break;
    68		case FLOW_OFFLOAD_TYPE_BRIDGE:
    69			dst_port = flow_offload_fill_bridge_dst(ft, &flow_dst->forward, dir);
    70			break;
    71		}
    72	
    73		ft->dst.type = flow_dst->type;
    74		ft->dir = dir;
    75	
    76		switch (ctt->src.l3num) {
    77		case NFPROTO_IPV4:
    78			ft->src_v4 = ctt->src.u3.in;
    79			ft->dst_v4 = ctt->dst.u3.in;
    80			if (flow_dst->type == FLOW_OFFLOAD_TYPE_INET)
    81				ft->mtu = ip_dst_mtu_maybe_forward(dst, true);
    82			else
  > 83				ft->mtu = dst_port->dev->mtu;
    84			break;
    85		case NFPROTO_IPV6:
    86			ft->src_v6 = ctt->src.u3.in6;
    87			ft->dst_v6 = ctt->dst.u3.in6;
    88			ft->mtu = ip6_dst_mtu_forward(dst);
    89			break;
    90		}
    91	
    92		ft->l3proto = ctt->src.l3num;
    93		ft->l4proto = ctt->dst.protonum;
    94		ft->src_port = ctt->src.u.tcp.port;
    95		ft->dst_port = ctt->dst.u.tcp.port;
    96	}
    97	

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

Attachment: .config.gz
Description: application/gzip


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

  Powered by Linux