summaryrefslogtreecommitdiffstats
path: root/drivers/net/team
diff options
context:
space:
mode:
authorJiri Pirko <jpirko@redhat.com>2011-11-17 06:32:37 +0000
committerDavid S. Miller <davem@davemloft.net>2011-11-18 14:55:03 -0500
commitf8a15af093b19b86d56933c8757cee298d0f32a8 (patch)
treea6e8cc92edac10c26b6336671aa4d24fc4bb9e9d /drivers/net/team
parent2bba19fff8d09bf19df5d5e2de7188d65de67c3e (diff)
downloadblackbird-op-linux-f8a15af093b19b86d56933c8757cee298d0f32a8.tar.gz
blackbird-op-linux-f8a15af093b19b86d56933c8757cee298d0f32a8.zip
team: replace kmalloc+memcpy by kmemdup
Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/team')
-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++)
OpenPOWER on IntegriCloud