tunneling: Don't shadow vport when generating cache.
authorJesse Gross <jesse@nicira.com>
Tue, 28 Dec 2010 05:19:35 +0000 (21:19 -0800)
committerJesse Gross <jesse@nicira.com>
Tue, 28 Dec 2010 17:38:59 +0000 (09:38 -0800)
When generating the tunnel header cache we have two vports that we
are working with: the sender and destination.  Unfortunately, both of
these use the name 'vport'.  This renames the destination to avoid
shadowing the sender.  This doesn't actually fix a bug because the
compiler correctly uses the right one, even when shadowed.

Found with sparse.

Reported-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
datapath/tunnel.c

index c78e7ddf2b6182bdc0e0eff6add37ee8f0e454ca..5a9f8f360a3f8d0a6fdf2965065ace94af809569 100644 (file)
@@ -912,13 +912,13 @@ static struct tnl_cache *build_cache(struct vport *vport,
        if (is_internal_dev(rt_dst(rt).dev)) {
                struct odp_flow_key flow_key;
                struct tbl_node *flow_node;
-               struct vport *vport;
+               struct vport *dst_vport;
                struct sk_buff *skb;
                bool is_frag;
                int err;
 
-               vport = internal_dev_get_vport(rt_dst(rt).dev);
-               if (!vport)
+               dst_vport = internal_dev_get_vport(rt_dst(rt).dev);
+               if (!dst_vport)
                        goto done;
 
                skb = alloc_skb(cache->len, GFP_ATOMIC);
@@ -928,13 +928,13 @@ static struct tnl_cache *build_cache(struct vport *vport,
                __skb_put(skb, cache->len);
                memcpy(skb->data, get_cached_header(cache), cache->len);
 
-               err = flow_extract(skb, vport->port_no, &flow_key, &is_frag);
+               err = flow_extract(skb, dst_vport->port_no, &flow_key, &is_frag);
 
                kfree_skb(skb);
                if (err || is_frag)
                        goto done;
 
-               flow_node = tbl_lookup(rcu_dereference(vport->dp->table),
+               flow_node = tbl_lookup(rcu_dereference(dst_vport->dp->table),
                                       &flow_key, flow_hash(&flow_key),
                                       flow_cmp);
                if (flow_node) {