From: Ben Pfaff Date: Wed, 30 Apr 2008 23:26:33 +0000 (-0700) Subject: Clear padding bytes in fill_flow_stats(), to avoid state leakage. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8416ecdee2705b7ee0fde8048474144b114b73b;p=openvswitch Clear padding bytes in fill_flow_stats(), to avoid state leakage. Found by valgrind. --- 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