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 cfebab803b9c96992c2d1e14ffbae78d3ecd4c66..83be31124cf0bf464fd9eb9e7397550989858b56 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 6ea51e367cfdaafb5b928d34b6db56207ad16bd5..1332a4c65eaa64d0fcf716b57d1a20ba2b95bebb 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