]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[IPVS]: Use kmemdup where appropriate
authorArnaldo Carvalho de Melo <acme@mandriva.com>
Tue, 21 Nov 2006 03:17:18 +0000 (01:17 -0200)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 3 Dec 2006 05:30:16 +0000 (21:30 -0800)
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
net/ipv4/ipvs/ip_vs_app.c
net/ipv4/ipvs/ip_vs_proto.c

index e7752334d29648907dae8183c720f3e90e95a7cd..6c40899aa16172a7f6bc79e9bcf590e43ebbd400 100644 (file)
@@ -80,10 +80,9 @@ ip_vs_app_inc_new(struct ip_vs_app *app, __u16 proto, __u16 port)
        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;
index c4528b5c800d04a257f2d806ed6414378b98ea31..e844ddb82b9a9e20cdedaf886111cb21e0daf23e 100644 (file)
@@ -118,13 +118,7 @@ void ip_vs_protocol_timeout_change(int flags)
 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);
 }