team: replace kmalloc+memcpy by kmemdup
Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Родитель
2bba19fff8
Коммит
f8a15af093
|
@ -104,19 +104,15 @@ int team_options_register(struct team *team,
|
||||||
if (!dst_opts)
|
if (!dst_opts)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
for (i = 0; i < option_count; i++, option++) {
|
for (i = 0; i < option_count; i++, option++) {
|
||||||
struct team_option *dst_opt;
|
|
||||||
|
|
||||||
if (__team_find_option(team, option->name)) {
|
if (__team_find_option(team, option->name)) {
|
||||||
err = -EEXIST;
|
err = -EEXIST;
|
||||||
goto rollback;
|
goto rollback;
|
||||||
}
|
}
|
||||||
dst_opt = kmalloc(sizeof(*option), GFP_KERNEL);
|
dst_opts[i] = kmemdup(option, sizeof(*option), GFP_KERNEL);
|
||||||
if (!dst_opt) {
|
if (!dst_opts[i]) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto rollback;
|
goto rollback;
|
||||||
}
|
}
|
||||||
memcpy(dst_opt, option, sizeof(*option));
|
|
||||||
dst_opts[i] = dst_opt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < option_count; i++)
|
for (i = 0; i < option_count; i++)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче