[ovs-dev] [PATCH 02/12] ofp-util: Fully initialize flow_wildcards in ofputil_cls_rule_from_match().

Ben Pfaff blp at nicira.com
Tue Dec 7 19:00:24 UTC 2010


The new 'zero' member was not being properly initialized.  One approach
would be to add an assignment, but it seems more future-proof to let
flow_wildcards_init_catchall() do the right thing.

Noticed by valgrind.
---
 lib/ofp-util.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 11836cc..9fabecb 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -117,11 +117,11 @@ ofputil_cls_rule_from_match(const struct ofp_match *match,
     rule->priority = !ofpfw ? UINT16_MAX : priority;
 
     /* Initialize most of rule->wc. */
+    flow_wildcards_init_catchall(wc);
     wc->wildcards = ofpfw & WC_INVARIANTS;
     if (ofpfw & OFPFW_NW_TOS) {
         wc->wildcards |= FWW_NW_TOS;
     }
-    memset(wc->reg_masks, 0, sizeof wc->reg_masks);
     wc->nw_src_mask = ofputil_wcbits_to_netmask(ofpfw >> OFPFW_NW_SRC_SHIFT);
     wc->nw_dst_mask = ofputil_wcbits_to_netmask(ofpfw >> OFPFW_NW_DST_SHIFT);
 
-- 
1.7.1





More information about the dev mailing list