From: YAMAMOTO Takashi Date: Thu, 20 Feb 2014 02:11:00 +0000 (+0900) Subject: ofp-util: Avoid gcc warning on NetBSD X-Git-Tag: sliver-openvswitch-2.1.90-1~1^2~25 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=bf062576fd748fc526903c428ffa847032a7b1d0 ofp-util: Avoid gcc warning on NetBSD Avoid the following warning caused by the combination of NetBSD's htons implementation and gcc bug. Now --enable-Werror build succeeds on NetBSD-6. lib/ofp-util.c: In function 'ofputil_match_from_ofp10_match': lib/ofp-util.c:174:15: error: integer overflow in expression Signed-off-by: YAMAMOTO Takashi Signed-off-by: Ben Pfaff --- diff --git a/lib/ofp-util.c b/lib/ofp-util.c index aa25e67b5..fca18deed 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -169,9 +169,11 @@ ofputil_match_from_ofp10_match(const struct ofp10_match *ofmatch, match->wc.masks.vlan_tci = htons(0xffff); } else { ovs_be16 vid, pcp, tci; + uint16_t hpcp; vid = ofmatch->dl_vlan & htons(VLAN_VID_MASK); - pcp = htons((ofmatch->dl_vlan_pcp << VLAN_PCP_SHIFT) & VLAN_PCP_MASK); + hpcp = (ofmatch->dl_vlan_pcp << VLAN_PCP_SHIFT) & VLAN_PCP_MASK; + pcp = htons(hpcp); tci = vid | pcp | htons(VLAN_CFI); match->flow.vlan_tci = tci & match->wc.masks.vlan_tci; }