Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
        if (!pp->unregister_app)
                return -EOPNOTSUPP;
 
-       inc = kmalloc(sizeof(struct ip_vs_app), GFP_KERNEL);
+       inc = kmemdup(app, sizeof(*inc), GFP_KERNEL);
        if (!inc)
                return -ENOMEM;
-       memcpy(inc, app, sizeof(*inc));
        INIT_LIST_HEAD(&inc->p_list);
        INIT_LIST_HEAD(&inc->incs_list);
        inc->app = app;
 
 int *
 ip_vs_create_timeout_table(int *table, int size)
 {
-       int *t;
-
-       t = kmalloc(size, GFP_ATOMIC);
-       if (t == NULL)
-               return NULL;
-       memcpy(t, table, size);
-       return t;
+       return kmemdup(table, size, GFP_ATOMIC);
 }