summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/team/team.c8
1 files 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++)