Commit 8b2ed4bb authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller

[IPVS]: Use kmemdup where appropriate

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@mandriva.com>
parent e6b61105
...@@ -80,10 +80,9 @@ ip_vs_app_inc_new(struct ip_vs_app *app, __u16 proto, __u16 port) ...@@ -80,10 +80,9 @@ ip_vs_app_inc_new(struct ip_vs_app *app, __u16 proto, __u16 port)
if (!pp->unregister_app) if (!pp->unregister_app)
return -EOPNOTSUPP; return -EOPNOTSUPP;
inc = kmalloc(sizeof(struct ip_vs_app), GFP_KERNEL); inc = kmemdup(app, sizeof(*inc), GFP_KERNEL);
if (!inc) if (!inc)
return -ENOMEM; return -ENOMEM;
memcpy(inc, app, sizeof(*inc));
INIT_LIST_HEAD(&inc->p_list); INIT_LIST_HEAD(&inc->p_list);
INIT_LIST_HEAD(&inc->incs_list); INIT_LIST_HEAD(&inc->incs_list);
inc->app = app; inc->app = app;
......
...@@ -118,13 +118,7 @@ void ip_vs_protocol_timeout_change(int flags) ...@@ -118,13 +118,7 @@ void ip_vs_protocol_timeout_change(int flags)
int * int *
ip_vs_create_timeout_table(int *table, int size) ip_vs_create_timeout_table(int *table, int size)
{ {
int *t; return kmemdup(table, size, GFP_ATOMIC);
t = kmalloc(size, GFP_ATOMIC);
if (t == NULL)
return NULL;
memcpy(t, table, size);
return t;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment