From: Jiri Pirko <jpirko@redhat.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, eric.dumazet@gmail.com,
bhutchings@solarflare.com, shemminger@vyatta.com,
andy@greyhouse.net, fbl@redhat.com, jzupka@redhat.com,
ivecera@redhat.com
Subject: [patch net-next] team: replace kmalloc+memcpy by kmemdup
Date: Thu, 17 Nov 2011 17:32:37 +0100 [thread overview]
Message-ID: <1321547557-1175-1-git-send-email-jpirko@redhat.com> (raw)
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
drivers/net/team/team.c | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index c48ef19..064155d 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++)
--
1.7.6
next reply other threads:[~2011-11-17 16:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-17 16:32 Jiri Pirko [this message]
2011-11-18 20:00 ` [patch net-next] team: replace kmalloc+memcpy by kmemdup David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1321547557-1175-1-git-send-email-jpirko@redhat.com \
--to=jpirko@redhat.com \
--cc=andy@greyhouse.net \
--cc=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=fbl@redhat.com \
--cc=ivecera@redhat.com \
--cc=jzupka@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).