ofp-util: Fully initialize flow_wildcards in ofputil_cls_rule_from_match().
authorBen Pfaff <blp@nicira.com>
Tue, 7 Dec 2010 00:11:55 +0000 (16:11 -0800)
committerBen Pfaff <blp@nicira.com>
Tue, 7 Dec 2010 21:44:06 +0000 (13:44 -0800)
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.

Acked-by: Jesse Gross <jesse@nicira.com>
lib/ofp-util.c

index cf832b7d7afeec556d21fed9e8ab387f3ec0e12a..2c525baf0d2a209a67853ffae3d247f3aa69dab5 100644 (file)
@@ -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);