odp-util: Only add recirc_id mask to Netlink message if mask is provided
authorThomas Graf <tgraf@noironetworks.com>
Tue, 26 Aug 2014 16:34:52 +0000 (18:34 +0200)
committerBen Pfaff <blp@nicira.com>
Tue, 26 Aug 2014 18:24:27 +0000 (11:24 -0700)
Current unconditional call may result in NULL being passed to
nl_msg_put_u32().

Cc: Andy Zhou <azhou@nicira.com>
Signed-off-by: Thomas Graf <tgraf@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/odp-util.c

index 34ac5cd..6c5ec3c 100644 (file)
@@ -1657,7 +1657,9 @@ parse_odp_key_mask_attr(const char *s, const struct simap *port_names,
 
         if (ovs_scan(s, "recirc_id(%"SCNi32")%n", &recirc_id, &n)) {
             nl_msg_put_u32(key, OVS_KEY_ATTR_RECIRC_ID, recirc_id);
-            nl_msg_put_u32(mask, OVS_KEY_ATTR_RECIRC_ID, UINT32_MAX);
+            if (mask) {
+                nl_msg_put_u32(mask, OVS_KEY_ATTR_RECIRC_ID, UINT32_MAX);
+            }
             return n;
         }
     }