From f8a15af093b19b86d56933c8757cee298d0f32a8 Mon Sep 17 00:00:00 2001 From: Jiri Pirko Date: Thu, 17 Nov 2011 06:32:37 +0000 Subject: [PATCH] team: replace kmalloc+memcpy by kmemdup Signed-off-by: Jiri Pirko Signed-off-by: David S. Miller --- drivers/net/team/team.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index c48ef19cac13..064155d56bce 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c @@ -104,19 +104,15 @@ int team_options_register(struct team *team, if (!dst_opts) return -ENOMEM; for (i = 0; i < option_count; i++, option++) { - struct team_option *dst_opt; - if (__team_find_option(team, option->name)) { err = -EEXIST; goto rollback; } - dst_opt = kmalloc(sizeof(*option), GFP_KERNEL); - if (!dst_opt) { + dst_opts[i] = kmemdup(option, sizeof(*option), GFP_KERNEL); + if (!dst_opts[i]) { err = -ENOMEM; goto rollback; } - memcpy(dst_opt, option, sizeof(*option)); - dst_opts[i] = dst_opt; } for (i = 0; i < option_count; i++) -- 2.20.1