diff mbox

[ovs-dev] ofp-util: Zero out padding bytes in ofputil_ipfix_stats_to_reply().

Message ID 1466978044-15213-1-git-send-email-blp@ovn.org
State Accepted
Headers show

Commit Message

Ben Pfaff June 26, 2016, 9:54 p.m. UTC
Otherwise IPFIX statistics leak memory from ovs-vswitchd.

Reported-by: William Tu <u9012063@gmail.com>
Reported-at: http://openvswitch.org/pipermail/dev/2016-June/073769.html
Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 lib/ofp-util.c | 1 +
 1 file changed, 1 insertion(+)

Comments

William Tu June 27, 2016, 12:38 a.m. UTC | #1
Thanks, the patch solves the valgrind error.

Acked-by: William Tu <u9012063@gmail.com>

On Sun, Jun 26, 2016 at 2:54 PM, Ben Pfaff <blp@ovn.org> wrote:
> Otherwise IPFIX statistics leak memory from ovs-vswitchd.
>
> Reported-by: William Tu <u9012063@gmail.com>
> Reported-at: http://openvswitch.org/pipermail/dev/2016-June/073769.html
> 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 6519e62..cc9f5e0 100644
> --- a/lib/ofp-util.c
> +++ b/lib/ofp-util.c
> @@ -7982,6 +7982,7 @@ ofputil_ipfix_stats_to_reply(const struct ofputil_ipfix_stats *ois,
>      reply->ipv6_error_pkts = htonll(ois->ipv6_error_pkts);
>      reply->tx_pkts = htonll(ois->tx_pkts);
>      reply->tx_errors = htonll(ois->tx_errors);
> +    memset(reply->pad, 0, sizeof reply->pad);
>  }
>
>  /* Encode a ipfix stat for 'ois' and append it to 'replies'. */
> --
> 2.1.3
>
Ben Pfaff June 27, 2016, 3:26 a.m. UTC | #2
Thanks, applied to master.

On Sun, Jun 26, 2016 at 05:38:55PM -0700, William Tu wrote:
> Thanks, the patch solves the valgrind error.
> 
> Acked-by: William Tu <u9012063@gmail.com>
> 
> On Sun, Jun 26, 2016 at 2:54 PM, Ben Pfaff <blp@ovn.org> wrote:
> > Otherwise IPFIX statistics leak memory from ovs-vswitchd.
> >
> > Reported-by: William Tu <u9012063@gmail.com>
> > Reported-at: http://openvswitch.org/pipermail/dev/2016-June/073769.html
> > 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 6519e62..cc9f5e0 100644
> > --- a/lib/ofp-util.c
> > +++ b/lib/ofp-util.c
> > @@ -7982,6 +7982,7 @@ ofputil_ipfix_stats_to_reply(const struct ofputil_ipfix_stats *ois,
> >      reply->ipv6_error_pkts = htonll(ois->ipv6_error_pkts);
> >      reply->tx_pkts = htonll(ois->tx_pkts);
> >      reply->tx_errors = htonll(ois->tx_errors);
> > +    memset(reply->pad, 0, sizeof reply->pad);
> >  }
> >
> >  /* Encode a ipfix stat for 'ois' and append it to 'replies'. */
> > --
> > 2.1.3
> >
diff mbox

Patch

diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 6519e62..cc9f5e0 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -7982,6 +7982,7 @@  ofputil_ipfix_stats_to_reply(const struct ofputil_ipfix_stats *ois,
     reply->ipv6_error_pkts = htonll(ois->ipv6_error_pkts);
     reply->tx_pkts = htonll(ois->tx_pkts);
     reply->tx_errors = htonll(ois->tx_errors);
+    memset(reply->pad, 0, sizeof reply->pad);
 }
 
 /* Encode a ipfix stat for 'ois' and append it to 'replies'. */