Message ID | 20170612165442.16518-1-blp@ovn.org |
---|---|
State | Accepted |
Headers | show |
> From: "Ben Pfaff" <blp@ovn.org> > To: dev@openvswitch.org > Cc: "Ben Pfaff" <blp@ovn.org> > Sent: Monday, 12 June, 2017 12:54:42 PM > Subject: [ovs-dev] [PATCH] ofp-util: Initialize tunnel metadata for OpenFlow 1.0 matches. > > Found by valgrind. > > Signed-off-by: Ben Pfaff <blp@ovn.org> > --- > lib/ofp-util.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/lib/ofp-util.c b/lib/ofp-util.c > index 601a719797e5..da171cdf6fe5 100644 > --- a/lib/ofp-util.c > +++ b/lib/ofp-util.c > @@ -159,6 +159,7 @@ ofputil_match_from_ofp10_match(const struct ofp10_match > *ofmatch, > /* Initialize match->wc. */ > memset(&match->flow, 0, sizeof match->flow); > ofputil_wildcard_from_ofpfw10(ofpfw, &match->wc); > + memset(&match->tun_md, 0, sizeof match->tun_md); > > /* Initialize most of match->flow. */ > match->flow.nw_src = ofmatch->nw_src; > -- > 2.10.2 > Strangely enough, I was just looking at error reports from gcc + ubsan and clang + memory sanitizer for this very problem. (The memory sanitizer is *much* faster than valgrind, btw...). Tested-by: Lance Richardson <lrichard@redhat.com> Acked-by: Lance Richardson <lrichard@redhat.com>
On Mon, Jun 12, 2017 at 01:24:37PM -0400, Lance Richardson wrote: > > From: "Ben Pfaff" <blp@ovn.org> > > To: dev@openvswitch.org > > Cc: "Ben Pfaff" <blp@ovn.org> > > Sent: Monday, 12 June, 2017 12:54:42 PM > > Subject: [ovs-dev] [PATCH] ofp-util: Initialize tunnel metadata for OpenFlow 1.0 matches. > > > > Found by valgrind. > > > > Signed-off-by: Ben Pfaff <blp@ovn.org> > > --- > > lib/ofp-util.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/lib/ofp-util.c b/lib/ofp-util.c > > index 601a719797e5..da171cdf6fe5 100644 > > --- a/lib/ofp-util.c > > +++ b/lib/ofp-util.c > > @@ -159,6 +159,7 @@ ofputil_match_from_ofp10_match(const struct ofp10_match > > *ofmatch, > > /* Initialize match->wc. */ > > memset(&match->flow, 0, sizeof match->flow); > > ofputil_wildcard_from_ofpfw10(ofpfw, &match->wc); > > + memset(&match->tun_md, 0, sizeof match->tun_md); > > > > /* Initialize most of match->flow. */ > > match->flow.nw_src = ofmatch->nw_src; > > -- > > 2.10.2 > > > > Strangely enough, I was just looking at error reports from gcc + ubsan > and clang + memory sanitizer for this very problem. (The memory sanitizer > is *much* faster than valgrind, btw...). > > Tested-by: Lance Richardson <lrichard@redhat.com> > Acked-by: Lance Richardson <lrichard@redhat.com> Thanks, applied to master, branch-2.7, branch-2.6, and branch-2.5.
diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 601a719797e5..da171cdf6fe5 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -159,6 +159,7 @@ ofputil_match_from_ofp10_match(const struct ofp10_match *ofmatch, /* Initialize match->wc. */ memset(&match->flow, 0, sizeof match->flow); ofputil_wildcard_from_ofpfw10(ofpfw, &match->wc); + memset(&match->tun_md, 0, sizeof match->tun_md); /* Initialize most of match->flow. */ match->flow.nw_src = ofmatch->nw_src;
Found by valgrind. Signed-off-by: Ben Pfaff <blp@ovn.org> --- lib/ofp-util.c | 1 + 1 file changed, 1 insertion(+)