提交 f8a15af0 编写于 作者: J Jiri Pirko 提交者: David S. Miller

team: replace kmalloc+memcpy by kmemdup

Signed-off-by: NJiri Pirko <jpirko@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 2bba19ff
...@@ -104,19 +104,15 @@ int team_options_register(struct team *team, ...@@ -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++)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册