]> git.proxmox.com Git - ovs.git/commitdiff
dpif-linux: Make dummy_action const in dpif_linux_init_flow_put().
authorBen Pfaff <blp@nicira.com>
Tue, 23 Apr 2013 21:06:25 +0000 (14:06 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 3 May 2013 20:29:46 +0000 (13:29 -0700)
This makes this code more obviously thread-safe.

Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/dpif-linux.c

index 933aabed137d89246185ee236639b5aee1c5bc95..ac20ae7540c1c9a560fed698cddee12d015a90f7 100644 (file)
@@ -795,7 +795,7 @@ static void
 dpif_linux_init_flow_put(struct dpif *dpif_, const struct dpif_flow_put *put,
                          struct dpif_linux_flow *request)
 {
-    static struct nlattr dummy_action;
+    static const struct nlattr dummy_action;
 
     struct dpif_linux *dpif = dpif_linux_cast(dpif_);
 
@@ -806,7 +806,9 @@ dpif_linux_init_flow_put(struct dpif *dpif_, const struct dpif_flow_put *put,
     request->key = put->key;
     request->key_len = put->key_len;
     /* Ensure that OVS_FLOW_ATTR_ACTIONS will always be included. */
-    request->actions = put->actions ? put->actions : &dummy_action;
+    request->actions = (put->actions
+                        ? put->actions
+                        : CONST_CAST(struct nlattr *, &dummy_action));
     request->actions_len = put->actions_len;
     if (put->flags & DPIF_FP_ZERO_STATS) {
         request->clear = true;