IB/i40iw: Use kmemdup rather than open coding
[sfrench/cifs-2.6.git] / drivers / infiniband / hw / i40iw / i40iw_cm.c
index 8233f5a4e623d9a7d83b4d8f190ba3c016d66378..84b3ff2687fb008efe258285580817777b4a8810 100644 (file)
@@ -4276,11 +4276,11 @@ static void i40iw_qhash_ctrl(struct i40iw_device *iwdev,
        /* if not found then add a child listener if interface is going up */
        if (!ifup)
                return;
-       child_listen_node = kzalloc(sizeof(*child_listen_node), GFP_ATOMIC);
+       child_listen_node = kmemdup(parent_listen_node,
+                       sizeof(*child_listen_node), GFP_ATOMIC);
        if (!child_listen_node)
                return;
        node_allocated = true;
-       memcpy(child_listen_node, parent_listen_node, sizeof(*child_listen_node));
 
        memcpy(child_listen_node->loc_addr, ipaddr,  ipv4 ? 4 : 16);