]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - net/irda/irlmp.c
[IRDA]: Use kmemdup where applicable
[karo-tx-linux.git] / net / irda / irlmp.c
index fede83763095085c36d4866c29eeb08d477464e5..7e5d12ab3b90dd1f580465089a6b150377eb07b9 100644 (file)
@@ -641,15 +641,13 @@ struct lsap_cb *irlmp_dup(struct lsap_cb *orig, void *instance)
        }
 
        /* Allocate a new instance */
-       new = kmalloc(sizeof(struct lsap_cb), GFP_ATOMIC);
+       new = kmemdup(orig, sizeof(*new), GFP_ATOMIC);
        if (!new)  {
                IRDA_DEBUG(0, "%s(), unable to kmalloc\n", __FUNCTION__);
                spin_unlock_irqrestore(&irlmp->unconnected_lsaps->hb_spinlock,
                                       flags);
                return NULL;
        }
-       /* Dup */
-       memcpy(new, orig, sizeof(struct lsap_cb));
        /* new->lap = orig->lap; => done in the memcpy() */
        /* new->slsap_sel = orig->slsap_sel; => done in the memcpy() */
        new->conn_skb = NULL;