[ovs-dev] [PATCH branch-2.3] dpif-netdev: Initialize upcall->packet when queuing to userspace.

Ben Pfaff blp at nicira.com
Mon Aug 4 19:16:25 UTC 2014

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 at nicira.com>
CC: Pravin Shelar <pshelar at nicira.com>
 lib/dpif-netdev.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index fb35306..69e15d7 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -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,
-        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));

More information about the dev mailing list