Hi Pieter,

Thank you for the patch! Perhaps something to improve:

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

url:    
https://github.com/0day-ci/linux/commits/Jakub-Kicinski/net-Geneve-options-support-for-TC-act_tunnel_key/20180627-030036
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> net/openvswitch/flow_netlink.c:2532:38: sparse: incorrect type in assignment 
>> (different base types) @@    expected int [signed] [assigned] dst_opt_type 
>> @@    got restrint [signed] [assigned] dst_opt_type @@
   net/openvswitch/flow_netlink.c:2532:38:    expected int [signed] [assigned] 
dst_opt_type
   net/openvswitch/flow_netlink.c:2532:38:    got restricted __be16 [usertype] 
<noident>
   net/openvswitch/flow_netlink.c:2535:38: sparse: incorrect type in assignment 
(different base types) @@    expected int [signed] [assigned] dst_opt_type @@   
 got restrint [signed] [assigned] dst_opt_type @@
   net/openvswitch/flow_netlink.c:2535:38:    expected int [signed] [assigned] 
dst_opt_type
   net/openvswitch/flow_netlink.c:2535:38:    got restricted __be16 [usertype] 
<noident>
   net/openvswitch/flow_netlink.c:2538:38: sparse: incorrect type in assignment 
(different base types) @@    expected int [signed] [assigned] dst_opt_type @@   
 got restrint [signed] [assigned] dst_opt_type @@
   net/openvswitch/flow_netlink.c:2538:38:    expected int [signed] [assigned] 
dst_opt_type
   net/openvswitch/flow_netlink.c:2538:38:    got restricted __be16 [usertype] 
<noident>
>> net/openvswitch/flow_netlink.c:2581:51: sparse: incorrect type in argument 4 
>> (different base types) @@    expected restricted __be16 [usertype] flags @@  
>>   got icted __be16 [usertype] flags @@
   net/openvswitch/flow_netlink.c:2581:51:    expected restricted __be16 
[usertype] flags
   net/openvswitch/flow_netlink.c:2581:51:    got int [signed] [assigned] 
dst_opt_type
   net/openvswitch/flow_netlink.c:3064:39: sparse: expression using sizeof(void)

vim +2532 net/openvswitch/flow_netlink.c

  2508  
  2509  static int validate_and_copy_set_tun(const struct nlattr *attr,
  2510                                       struct sw_flow_actions **sfa, bool 
log)
  2511  {
  2512          struct sw_flow_match match;
  2513          struct sw_flow_key key;
  2514          struct metadata_dst *tun_dst;
  2515          struct ip_tunnel_info *tun_info;
  2516          struct ovs_tunnel_info *ovs_tun;
  2517          struct nlattr *a;
  2518          int err = 0, start, opts_type, dst_opt_type;
  2519  
  2520          dst_opt_type = 0;
  2521          ovs_match_init(&match, &key, true, NULL);
  2522          opts_type = ip_tun_from_nlattr(nla_data(attr), &match, false, 
log);
  2523          if (opts_type < 0)
  2524                  return opts_type;
  2525  
  2526          if (key.tun_opts_len) {
  2527                  switch (opts_type) {
  2528                  case OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS:
  2529                          err = validate_geneve_opts(&key);
  2530                          if (err < 0)
  2531                                  return err;
> 2532                          dst_opt_type = TUNNEL_GENEVE_OPT;
  2533                          break;
  2534                  case OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS:
  2535                          dst_opt_type = TUNNEL_VXLAN_OPT;
  2536                          break;
  2537                  case OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS:
  2538                          dst_opt_type = TUNNEL_ERSPAN_OPT;
  2539                          break;
  2540                  }
  2541          }
  2542  
  2543          start = add_nested_action_start(sfa, OVS_ACTION_ATTR_SET, log);
  2544          if (start < 0)
  2545                  return start;
  2546  
  2547          tun_dst = metadata_dst_alloc(key.tun_opts_len, 
METADATA_IP_TUNNEL,
  2548                                       GFP_KERNEL);
  2549  
  2550          if (!tun_dst)
  2551                  return -ENOMEM;
  2552  
  2553          err = dst_cache_init(&tun_dst->u.tun_info.dst_cache, 
GFP_KERNEL);
  2554          if (err) {
  2555                  dst_release((struct dst_entry *)tun_dst);
  2556                  return err;
  2557          }
  2558  
  2559          a = __add_action(sfa, OVS_KEY_ATTR_TUNNEL_INFO, NULL,
  2560                           sizeof(*ovs_tun), log);
  2561          if (IS_ERR(a)) {
  2562                  dst_release((struct dst_entry *)tun_dst);
  2563                  return PTR_ERR(a);
  2564          }
  2565  
  2566          ovs_tun = nla_data(a);
  2567          ovs_tun->tun_dst = tun_dst;
  2568  
  2569          tun_info = &tun_dst->u.tun_info;
  2570          tun_info->mode = IP_TUNNEL_INFO_TX;
  2571          if (key.tun_proto == AF_INET6)
  2572                  tun_info->mode |= IP_TUNNEL_INFO_IPV6;
  2573          tun_info->key = key.tun_key;
  2574  
  2575          /* We need to store the options in the action itself since
  2576           * everything else will go away after flow setup. We can append
  2577           * it to tun_info and then point there.
  2578           */
  2579          ip_tunnel_info_opts_set(tun_info,
  2580                                  TUN_METADATA_OPTS(&key, 
key.tun_opts_len),
> 2581                                  key.tun_opts_len, dst_opt_type);
  2582          add_nested_action_end(*sfa, start);
  2583  
  2584          return err;
  2585  }
  2586  

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

Reply via email to