On Wed, Dec 23, 2015 at 9:26 AM, Ben Pfaff <b...@ovn.org> wrote:

> On Fri, Dec 18, 2015 at 02:51:43PM -0800, Andy Zhou wrote:
> > On Tue, Dec 15, 2015 at 10:51 PM, Ben Pfaff <b...@ovn.org> wrote:
> > > Reported-by: weizj <334965...@qq.com>
> > > Reported-at: https://github.com/openvswitch/ovs/pull/97
> > > Signed-off-by: Ben Pfaff <b...@ovn.org>
> >
> > This fix makes sense to me.
> > Acked-by: Andy Zhou <az...@ovn.org>
>
> Thanks for the review.
>
> > If all assignments to 'reply' were grouped together, it may be
> > slightly easier to read.
>
> What do you mean?
>

This is what I mean.
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 126b555..24d96f7 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -2033,13 +2033,16 @@ ofputil_append_meter_config(struct ovs_list
*replies,
 {
     struct ofpbuf *msg = ofpbuf_from_list(list_back(replies));
     size_t start_ofs = msg->size;
-    struct ofp13_meter_config *reply = ofpbuf_put_uninit(msg, sizeof
*reply);
-    reply->flags = htons(mc->flags);
-    reply->meter_id = htonl(mc->meter_id);
+    struct ofp13_meter_config *reply;

+    ofpbuf_put_uninit(msg, sizeof *reply);
     ofputil_put_bands(mc->n_bands, mc->bands, msg);

-    reply->length = htons(msg->size - start_ofs);
+    reply = ofpbuf_at_assert(msg, start_ofs, sizeof *reply);
+
+    reply->length= htons(msg->size - start_ofs);
+    reply->flags = htons(mc->flags);
+    reply->meter_id = htonl(mc->meter_id);

     ofpmp_postappend(replies, start_ofs);
 }


> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to