[dpdk-dev,3/4] i40e_vsi_release: do not use vsi until after NULL check

Message ID 1475090404-20707-4-git-send-email-linville@tuxdriver.com (mailing list archive)
State Superseded, archived
Delegated to: Bruce Richardson
Headers

Commit Message

John W. Linville Sept. 28, 2016, 7:20 p.m. UTC
  Coverity: 127556

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
 drivers/net/i40e/i40e_ethdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Ferruh Yigit Sept. 29, 2016, 8:15 a.m. UTC | #1
On 9/28/2016 8:20 PM, John W. Linville wrote:
> Coverity: 127556
> 
> Signed-off-by: John W. Linville <linville@tuxdriver.com>

Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>


a few minor nits:
- patch subject tag/label should be "net/<driver>: ", so patch subject:
"net/i40e: do not use VSI until after NULL check"

- These are fixes, requires fixes line, for this patch:
Fixes: 440499cf5376 ("net/i40e: support floating VEB")

- For coverity fixes, defined usage is: "Coverity issue: XXXXX"

- Can be good to CC stable tree for these fixes.


Overall patch comment becomes something like:
"
net/i40e: do not use VSI until after NULL check

Coverity issue: 127556
Fixes: 440499cf5376 ("net/i40e: support floating VEB")

Signed-off-by: John W. Linville <linville@tuxdriver.com>
"
  

Patch

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index b04c833b2e04..d1f0f762b04c 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -4097,11 +4097,13 @@  i40e_vsi_release(struct i40e_vsi *vsi)
 	void *temp;
 	int ret;
 	struct i40e_mac_filter *f;
-	uint16_t user_param = vsi->user_param;
+	uint16_t user_param;
 
 	if (!vsi)
 		return I40E_SUCCESS;
 
+	user_param = vsi->user_param;
+
 	pf = I40E_VSI_TO_PF(vsi);
 	hw = I40E_VSI_TO_HW(vsi);