From patchwork Thu Nov 17 16:32:37 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 126281 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 1F9A4B71CC for ; Fri, 18 Nov 2011 03:32:52 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932380Ab1KQQcr (ORCPT ); Thu, 17 Nov 2011 11:32:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:13787 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932294Ab1KQQcr (ORCPT ); Thu, 17 Nov 2011 11:32:47 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pAHGWfE5025948 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 17 Nov 2011 11:32:42 -0500 Received: from localhost (ovpn-116-29.ams2.redhat.com [10.36.116.29]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id pAHGWdrH006857; Thu, 17 Nov 2011 11:32:39 -0500 From: Jiri Pirko 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 Message-Id: <1321547557-1175-1-git-send-email-jpirko@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Signed-off-by: Jiri Pirko --- 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++)