Skip to content

Commit

Permalink
net/xfrm: use kmemdup rather than duplicating its implementation
Browse files Browse the repository at this point in the history
The patch was generated using fixed coccinelle semantic patch
scripts/coccinelle/api/memdup.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2014320

Signed-off-by: Andrzej Hajda <[email protected]>
Signed-off-by: Steffen Klassert <[email protected]>
  • Loading branch information
Andrzej Hajda authored and klassert committed Aug 11, 2015
1 parent eae8dee commit df36756
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions net/xfrm/xfrm_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -925,12 +925,10 @@ static int xfrm_dump_sa(struct sk_buff *skb, struct netlink_callback *cb)
return err;

if (attrs[XFRMA_ADDRESS_FILTER]) {
filter = kmalloc(sizeof(*filter), GFP_KERNEL);
filter = kmemdup(nla_data(attrs[XFRMA_ADDRESS_FILTER]),
sizeof(*filter), GFP_KERNEL);
if (filter == NULL)
return -ENOMEM;

memcpy(filter, nla_data(attrs[XFRMA_ADDRESS_FILTER]),
sizeof(*filter));
}

if (attrs[XFRMA_PROTO])
Expand Down

0 comments on commit df36756

Please sign in to comment.