mirror of
https://github.com/openvswitch/ovs
synced 2025-10-19 14:37:21 +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:
@@ -2890,14 +2890,12 @@ static int
|
|||||||
scan_vxlan_gbp(const char *s, uint32_t *key, uint32_t *mask)
|
scan_vxlan_gbp(const char *s, uint32_t *key, uint32_t *mask)
|
||||||
{
|
{
|
||||||
const char *s_base = s;
|
const char *s_base = s;
|
||||||
ovs_be16 id, id_mask;
|
ovs_be16 id = 0, id_mask = 0;
|
||||||
uint8_t flags, flags_mask;
|
uint8_t flags = 0, flags_mask = 0;
|
||||||
|
|
||||||
if (!strncmp(s, "id=", 3)) {
|
if (!strncmp(s, "id=", 3)) {
|
||||||
s += 3;
|
s += 3;
|
||||||
s += scan_be16(s, &id, mask ? &id_mask : NULL);
|
s += scan_be16(s, &id, mask ? &id_mask : NULL);
|
||||||
} else if (mask) {
|
|
||||||
memset(&id_mask, 0, sizeof id_mask);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s[0] == ',') {
|
if (s[0] == ',') {
|
||||||
@@ -2906,8 +2904,6 @@ scan_vxlan_gbp(const char *s, uint32_t *key, uint32_t *mask)
|
|||||||
if (!strncmp(s, "flags=", 6)) {
|
if (!strncmp(s, "flags=", 6)) {
|
||||||
s += 6;
|
s += 6;
|
||||||
s += scan_u8(s, &flags, mask ? &flags_mask : NULL);
|
s += scan_u8(s, &flags, mask ? &flags_mask : NULL);
|
||||||
} else if (mask) {
|
|
||||||
memset(&flags_mask, 0, sizeof flags_mask);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strncmp(s, "))", 2)) {
|
if (!strncmp(s, "))", 2)) {
|
||||||
|
Reference in New Issue
Block a user