On Sat, Nov 02, 2013 at 05:56:09PM -0700, Ben Pfaff wrote: > On Wed, Oct 30, 2013 at 06:17:15PM +0900, Simon Horman wrote: > > Lightly exercise group desc and stats > > > > Signed-off-by: Simon Horman <ho...@verge.net.au> > > I was just thinking that we needed some tests here. > > These tests revealed an actual bug, by segfaulting. Running under > valgrind, I found the problem and folded in the following bug fixes:
Thanks for fixing that. Could you let me know how you ran the tests under valgrind? > > diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c > index 9e5a18c..915dc90 100644 > --- a/lib/ofp-parse.c > +++ b/lib/ofp-parse.c > @@ -2332,7 +2332,12 @@ parse_ofp_group_mod_file(const char *file_name, > uint16_t command, > char *error; > > if (*n_gms >= allocated_gms) { > + size_t i; > + > *gms = x2nrealloc(*gms, &allocated_gms, sizeof **gms); > + for (i = 0; i < *n_gms; i++) { > + list_moved(&(*gms)[i].buckets); > + } > } > error = parse_ofp_group_mod_str(&(*gms)[*n_gms], command, > ds_cstr(&s), > &usable); > diff --git a/lib/ofp-util.c b/lib/ofp-util.c > index 4109e1b..9645e04 100644 > --- a/lib/ofp-util.c > +++ b/lib/ofp-util.c > @@ -6162,11 +6162,11 @@ ofputil_encode_group_mod(enum ofp_version ofp_version, > case OFP13_VERSION: { > b = ofpraw_alloc(OFPRAW_OFPT11_GROUP_MOD, ofp_version, 0); > start_ogm = b->size; > - ofpbuf_put_uninit(b, sizeof *ogm); > + ofpbuf_put_zeros(b, sizeof *ogm); > > LIST_FOR_EACH (bucket, list_node, &gm->buckets) { > start_bucket = b->size; > - ofpbuf_put_uninit(b, sizeof *ob); > + ofpbuf_put_zeros(b, sizeof *ob); > if (bucket->ofpacts && bucket->ofpacts_len) { > ofpacts_put_openflow_actions(bucket->ofpacts, > bucket->ofpacts_len, b, > @@ -6181,7 +6181,6 @@ ofputil_encode_group_mod(enum ofp_version ofp_version, > ogm = ofpbuf_at_assert(b, start_ogm, sizeof *ogm); > ogm->command = htons(gm->command); > ogm->type = gm->type; > - ogm->pad = 0; > ogm->group_id = htonl(gm->group_id); > > break; > _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev