From f8416ecdee2705b7ee0fde8048474144b114b73b Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 30 Apr 2008 16:26:33 -0700 Subject: [PATCH] Clear padding bytes in fill_flow_stats(), to avoid state leakage. Found by valgrind. --- datapath/datapath.c | 5 +++-- switch/datapath.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index cfebab80..83be3112 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -849,10 +849,11 @@ fill_flow_stats(struct ofp_flow_stats *ofs, struct sw_flow *flow, ofs->match.tp_src = flow->key.tp_src; ofs->match.tp_dst = flow->key.tp_dst; ofs->duration = htonl((jiffies - flow->init_time) / HZ); - ofs->priority = htons(flow->priority); - ofs->table_id = table_idx; ofs->packet_count = cpu_to_be64(flow->packet_count); ofs->byte_count = cpu_to_be64(flow->byte_count); + ofs->priority = htons(flow->priority); + ofs->table_id = table_idx; + memset(ofs->pad, 0, sizeof ofs->pad); } static int diff --git a/switch/datapath.c b/switch/datapath.c index 6ea51e36..1332a4c6 100644 --- a/switch/datapath.c +++ b/switch/datapath.c @@ -670,10 +670,11 @@ fill_flow_stats(struct ofp_flow_stats *ofs, struct sw_flow *flow, ofs->match.tp_src = flow->key.flow.tp_src; ofs->match.tp_dst = flow->key.flow.tp_dst; ofs->duration = htonl(now - flow->created); - ofs->priority = htons(flow->priority); - ofs->table_id = table_idx; ofs->packet_count = htonll(flow->packet_count); ofs->byte_count = htonll(flow->byte_count); + ofs->priority = htons(flow->priority); + ofs->table_id = table_idx; + memset(ofs->pad, 0, sizeof ofs->pad); } int -- 2.30.2