On Thu, Jul 19, 2012 at 04:31:38PM +0900, Simon Horman wrote:
> On Thu, Jul 05, 2012 at 11:12:29PM -0700, Ben Pfaff wrote:
> > OpenFlow headers are not as uniform as they could be, with size, alignment,
> > and numbering changes from one version to another and across varieties
> > (e.g. ordinary messages vs. "stats" messages).  Until now the Open vSwitch
> > internal APIs haven't done a good job of abstracting those differences in
> > header formats.  This commit changes that; from this commit forward very
> > little code actually needs to understand the header format or numbering.
> > Instead, it can just encode or decode, or pull or put, the header using
> > a more abstract API using the ofpraw_, ofptype_, and other APIs in the
> > new ofp-msgs module.
> > 
> > Signed-off-by: Ben Pfaff <b...@nicira.com>

...

> > @@ -620,18 +608,21 @@ fetch_port_by_stats(const char *vconn_name,
> >          run(vconn_recv_block(vconn, &reply), "OpenFlow packet receive 
> > failed");
> >          recv_xid = ((struct ofp_header *) reply->data)->xid;
> >          if (send_xid == recv_xid) {
> > -            const struct ofputil_msg_type *type;
> > -            struct ofp_stats_msg *osm;
> > -
> > -            ofputil_decode_msg_type(reply->data, &type);
> > -            if (ofputil_msg_type_code(type) != 
> > OFPUTIL_OFPST_PORT_DESC_REPLY) {
> > +            struct ofp_header *oh;
> > +            enum ofptype type;
> > +            struct ofpbuf b;
> > +            uint16_t flags;
> > +
> > +            ofpbuf_use_const(&b, oh, ntohs(oh->length));
> 
> gcc tells me that oh is used uninitialised here and that does seem
> to be the case to me too.
> 
> Should it be initialised to ((struct ofp_header *) reply->data) ?

Thanks.  I folded this in:

diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index 425448e..aa91074 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -608,7 +608,7 @@ fetch_port_by_stats(const char *vconn_name,
         run(vconn_recv_block(vconn, &reply), "OpenFlow packet receive failed");
         recv_xid = ((struct ofp_header *) reply->data)->xid;
         if (send_xid == recv_xid) {
-            struct ofp_header *oh;
+            struct ofp_header *oh = reply->data;
             enum ofptype type;
             struct ofpbuf b;
             uint16_t flags;
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to