Clear padding bytes in fill_flow_stats(), to avoid state leakage.
authorBen Pfaff <blp@nicira.com>
Wed, 30 Apr 2008 23:26:33 +0000 (16:26 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 2 May 2008 00:02:31 +0000 (17:02 -0700)
Found by valgrind.

datapath/datapath.c
switch/datapath.c

index cfebab8..83be311 100644 (file)
@@ -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 
index 6ea51e3..1332a4c 100644 (file)
@@ -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