Skip to content

Commit

Permalink
team: replace kmalloc+memcpy by kmemdup
Browse files Browse the repository at this point in the history
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jiri Pirko authored and David S. Miller committed Nov 18, 2011
1 parent 2bba19f commit f8a15af
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions drivers/net/team/team.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down

0 comments on commit f8a15af

Please sign in to comment.