[ovs-dev] [PATCH] tc: Fix sparse warnings.

Ben Pfaff blp at ovn.org
Wed Jul 25 18:06:55 UTC 2018

Fixes the following warnings:

    ../lib/tc.c:817:37: error: incorrect type in assignment (different base types)
    ../lib/tc.c:817:37:    expected restricted ovs_be16 [usertype] vlan_push_tpid
    ../lib/tc.c:817:37:    got unsigned short
    ../lib/tc.c:1522:54: error: incorrect type in argument 2 (different base types)
    ../lib/tc.c:1522:54:    expected unsigned short [unsigned] [usertype] tpid
    ../lib/tc.c:1522:54:    got restricted ovs_be16 [usertype] vlan_push_tpid

CC: Jianbo Liu <jianbol at mellanox.com>
CC: Simon Horman <simon.horman at netronome.com>
Fixes: 61e8655cfc7a ("tc: Add VLAN tpid for push action")
Signed-off-by: Ben Pfaff <blp at ovn.org>
 lib/tc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/tc.c b/lib/tc.c
index 2157135bd762..ff91eda6f91d 100644
--- a/lib/tc.c
+++ b/lib/tc.c
@@ -814,7 +814,7 @@ nl_parse_act_vlan(struct nlattr *options, struct tc_flower *flower)
         struct nlattr *vlan_id = vlan_attrs[TCA_VLAN_PUSH_VLAN_ID];
         struct nlattr *vlan_prio = vlan_attrs[TCA_VLAN_PUSH_VLAN_PRIORITY];
-        action->vlan.vlan_push_tpid = nl_attr_get_u16(vlan_tpid);
+        action->vlan.vlan_push_tpid = nl_attr_get_be16(vlan_tpid);
         action->vlan.vlan_push_id = nl_attr_get_u16(vlan_id);
         action->vlan.vlan_push_prio = vlan_prio ? nl_attr_get_u8(vlan_prio) : 0;
         action->type = TC_ACT_VLAN_PUSH;
@@ -1186,7 +1186,7 @@ nl_msg_put_act_pedit(struct ofpbuf *request, struct tc_pedit *parm,
 static void
-nl_msg_put_act_push_vlan(struct ofpbuf *request, uint16_t tpid,
+nl_msg_put_act_push_vlan(struct ofpbuf *request, ovs_be16 tpid,
                          uint16_t vid, uint8_t prio)
     size_t offset;

More information about the dev mailing list