All of lore.kernel.org
 help / color / mirror / Atom feed
From: Declan Doherty <declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: dev-VfR2kkLFssw@public.gmane.org
Subject: [PATCH v3 3/3] bond: eth_dev parameter used before NULL check in mac_address_get/set
Date: Wed, 17 Dec 2014 11:46:59 +0000	[thread overview]
Message-ID: <1418816819-13517-4-git-send-email-declan.doherty@intel.com> (raw)
In-Reply-To: <1418816819-13517-3-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>


Signed-off-by: Declan Doherty <declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 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

  parent reply	other threads:[~2014-12-17 11:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-12 17:39 [PATCH] bond: static analysis issues fix Declan Doherty
     [not found] ` <1418405982-21407-1-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-12-12 18:30   ` Wodkowski, PawelX
2014-12-15 17:13   ` [PATCH v2] " Declan Doherty
     [not found]     ` <1418663630-27409-1-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-12-16  8:50       ` Wodkowski, PawelX
2014-12-16 17:31       ` Thomas Monjalon
2014-12-17 11:46       ` [PATCH v3 0/3] " Declan Doherty
     [not found]         ` <1418816819-13517-1-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-12-17 11:46           ` [PATCH v3 1/3] bond: add bounds check before assigning active slave count value Declan Doherty
     [not found]             ` <1418816819-13517-2-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-12-17 11:46               ` [PATCH v3 2/3] bond: fix pci_id_table allocation check in rte_eth_bond_create Declan Doherty
     [not found]                 ` <1418816819-13517-3-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-12-17 11:46                   ` Declan Doherty [this message]
2014-12-17 23:43           ` [PATCH v3 0/3] bond: static analysis issues fix Thomas Monjalon

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=1418816819-13517-4-git-send-email-declan.doherty@intel.com \
    --to=declan.doherty-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.