diff options
author | Andrzej Hajda <a.hajda@samsung.com> | 2015-08-07 03:59:34 -0400 |
---|---|---|
committer | Steffen Klassert <steffen.klassert@secunet.com> | 2015-08-11 06:41:35 -0400 |
commit | df367561ffe5a66cd0b2970fdb8897d5487d38e6 (patch) | |
tree | 7e2f80dcd117d09a9feb68fd8287361c6ce6f150 /net/xfrm | |
parent | eae8dee992af622fd992cb2370cd596ac80ef141 (diff) |
net/xfrm: use kmemdup rather than duplicating its implementation
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 <a.hajda@samsung.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/xfrm')
-rw-r--r-- | net/xfrm/xfrm_user.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 0cebf1fc37a2..a8de9e300200 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -925,12 +925,10 @@ static int xfrm_dump_sa(struct sk_buff *skb, struct netlink_callback *cb) | |||
925 | return err; | 925 | return err; |
926 | 926 | ||
927 | if (attrs[XFRMA_ADDRESS_FILTER]) { | 927 | if (attrs[XFRMA_ADDRESS_FILTER]) { |
928 | filter = kmalloc(sizeof(*filter), GFP_KERNEL); | 928 | filter = kmemdup(nla_data(attrs[XFRMA_ADDRESS_FILTER]), |
929 | sizeof(*filter), GFP_KERNEL); | ||
929 | if (filter == NULL) | 930 | if (filter == NULL) |
930 | return -ENOMEM; | 931 | return -ENOMEM; |
931 | |||
932 | memcpy(filter, nla_data(attrs[XFRMA_ADDRESS_FILTER]), | ||
933 | sizeof(*filter)); | ||
934 | } | 932 | } |
935 | 933 | ||
936 | if (attrs[XFRMA_PROTO]) | 934 | if (attrs[XFRMA_PROTO]) |