From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 34CC67F14 for ; Wed, 17 Dec 2014 12:47:07 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 17 Dec 2014 03:47:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,691,1406617200"; d="scan'208";a="500145897" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga003.jf.intel.com with ESMTP; 17 Dec 2014 03:42:50 -0800 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id sBHBl4Fa009858; Wed, 17 Dec 2014 11:47:04 GMT Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id sBHBl4qI014498; Wed, 17 Dec 2014 11:47:04 GMT Received: (from dwdohert@localhost) by sivswdev02.ir.intel.com with id sBHBl40f014494; Wed, 17 Dec 2014 11:47:04 GMT From: Declan Doherty To: dev@dpdk.org Date: Wed, 17 Dec 2014 11:46:59 +0000 Message-Id: <1418816819-13517-4-git-send-email-declan.doherty@intel.com> X-Mailer: git-send-email 1.7.12.2 In-Reply-To: <1418816819-13517-3-git-send-email-declan.doherty@intel.com> References: <1418663630-27409-1-git-send-email-declan.doherty@intel.com> <1418816819-13517-1-git-send-email-declan.doherty@intel.com> <1418816819-13517-2-git-send-email-declan.doherty@intel.com> <1418816819-13517-3-git-send-email-declan.doherty@intel.com> Subject: [dpdk-dev] [PATCH v3 3/3] bond: eth_dev parameter used before NULL check in mac_address_get/set X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Dec 2014 11:47:07 -0000 Signed-off-by: Declan Doherty --- lib/librte_pmd_bond/rte_eth_bond_pmd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c b/lib/librte_pmd_bond/rte_eth_bond_pmd.c index 3db473b..bb4a537 100644 --- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c +++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c @@ -764,8 +764,6 @@ mac_address_get(struct rte_eth_dev *eth_dev, struct ether_addr *dst_mac_addr) { struct ether_addr *mac_addr; - mac_addr = eth_dev->data->mac_addrs; - if (eth_dev == NULL) { RTE_LOG(ERR, PMD, "%s: NULL pointer eth_dev specified\n", __func__); return -1; @@ -776,6 +774,8 @@ mac_address_get(struct rte_eth_dev *eth_dev, struct ether_addr *dst_mac_addr) return -1; } + mac_addr = eth_dev->data->mac_addrs; + ether_addr_copy(mac_addr, dst_mac_addr); return 0; } @@ -785,8 +785,6 @@ mac_address_set(struct rte_eth_dev *eth_dev, struct ether_addr *new_mac_addr) { struct ether_addr *mac_addr; - mac_addr = eth_dev->data->mac_addrs; - if (eth_dev == NULL) { RTE_BOND_LOG(ERR, "NULL pointer eth_dev specified"); return -1; @@ -797,6 +795,8 @@ mac_address_set(struct rte_eth_dev *eth_dev, struct ether_addr *new_mac_addr) return -1; } + mac_addr = eth_dev->data->mac_addrs; + /* If new MAC is different to current MAC then update */ if (memcmp(mac_addr, new_mac_addr, sizeof(*mac_addr)) != 0) memcpy(mac_addr, new_mac_addr, sizeof(*mac_addr)); -- 1.7.12.2