[ovs-dev] [PATCH 3/4] odp-util: Simplify parsing function for GCC.
Jarno Rajahalme
jrajahalme at nicira.com
Tue Jun 9 22:25:09 UTC 2015
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 at nicira.com>
---
lib/odp-util.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/lib/odp-util.c b/lib/odp-util.c
index 3204d16..dee85c8 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -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)) {
--
1.7.10.4
More information about the dev
mailing list