dpif-netdev: Initialize upcall->packet when queuing to userspace.
authorBen Pfaff <blp@nicira.com>
Mon, 4 Aug 2014 19:16:25 +0000 (12:16 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 5 Aug 2014 17:52:16 +0000 (10:52 -0700)
Only the data and size members were being initialized, but all of them
should be.

This is inspired by commit b6f4590fa036 (dpif-netdev: Initialize
upcall->packet when queuing to userspace.) from master.  The background is
not exactly the same as on master (the commit that it references is not
on branch-2.3).

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
lib/dpif-netdev.c

index fb35306..69e15d7 100644 (file)
@@ -2077,6 +2077,7 @@ dp_netdev_output_userspace(struct dp_netdev *dp, struct ofpbuf *packet,
         struct ofpbuf *buf = &u->buf;
         size_t buf_size;
         struct flow flow;
+        void *data;
 
         upcall->type = type;
 
@@ -2100,8 +2101,8 @@ dp_netdev_output_userspace(struct dp_netdev *dp, struct ofpbuf *packet,
                                           NLA_ALIGN(userdata->nla_len));
         }
 
-        ofpbuf_set_data(&upcall->packet,
-                        ofpbuf_put(buf, ofpbuf_data(packet), ofpbuf_size(packet)));
+        data = ofpbuf_put(buf, ofpbuf_data(packet), ofpbuf_size(packet));
+        ofpbuf_use_stub(&upcall->packet, data, ofpbuf_size(packet));
         ofpbuf_set_size(&upcall->packet, ofpbuf_size(packet));
 
         seq_change(q->seq);