aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Pirko <jpirko@redhat.com>2011-11-17 01:32:37 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-18 14:55:03 -0500
commitf8a15af093b19b86d56933c8757cee298d0f32a8 (patch)
treea6e8cc92edac10c26b6336671aa4d24fc4bb9e9d
parent2bba19fff8d09bf19df5d5e2de7188d65de67c3e (diff)
team: replace kmalloc+memcpy by kmemdup
Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-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,
104 if (!dst_opts) 104 if (!dst_opts)
105 return -ENOMEM; 105 return -ENOMEM;
106 for (i = 0; i < option_count; i++, option++) { 106 for (i = 0; i < option_count; i++, option++) {
107 struct team_option *dst_opt;
108
109 if (__team_find_option(team, option->name)) { 107 if (__team_find_option(team, option->name)) {
110 err = -EEXIST; 108 err = -EEXIST;
111 goto rollback; 109 goto rollback;
112 } 110 }
113 dst_opt = kmalloc(sizeof(*option), GFP_KERNEL); 111 dst_opts[i] = kmemdup(option, sizeof(*option), GFP_KERNEL);
114 if (!dst_opt) { 112 if (!dst_opts[i]) {
115 err = -ENOMEM; 113 err = -ENOMEM;
116 goto rollback; 114 goto rollback;
117 } 115 }
118 memcpy(dst_opt, option, sizeof(*option));
119 dst_opts[i] = dst_opt;
120 } 116 }
121 117
122 for (i = 0; i < option_count; i++) 118 for (i = 0; i < option_count; i++)