2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 22:35:15 +00:00

odp-util: Simplify parsing function for GCC.

GCC 4.7.2 -O3 flagged potential use before initialization for the 'id'
and 'id_mask' being scanned in scan_vxlan_gbp().  For the 'id' this
was a real possiblity, but for the 'id_mask' it seems to be a false
positive in gcc analysis.  Simplify scan_vxlan_gbp() to fix this.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Jarno Rajahalme
2015-06-09 15:24:33 -07:00
parent d426c66cad
commit 3139b8e909

View File

@@ -2890,14 +2890,12 @@ static int
scan_vxlan_gbp(const char *s, uint32_t *key, uint32_t *mask)
{
const char *s_base = s;
ovs_be16 id, id_mask;
uint8_t flags, flags_mask;
ovs_be16 id = 0, id_mask = 0;
uint8_t flags = 0, flags_mask = 0;
if (!strncmp(s, "id=", 3)) {
s += 3;
s += scan_be16(s, &id, mask ? &id_mask : NULL);
} else if (mask) {
memset(&id_mask, 0, sizeof id_mask);
}
if (s[0] == ',') {
@@ -2906,8 +2904,6 @@ scan_vxlan_gbp(const char *s, uint32_t *key, uint32_t *mask)
if (!strncmp(s, "flags=", 6)) {
s += 6;
s += scan_u8(s, &flags, mask ? &flags_mask : NULL);
} else if (mask) {
memset(&flags_mask, 0, sizeof flags_mask);
}
if (!strncmp(s, "))", 2)) {