[dpdk-dev,v2] net/avf: fix uninitialized variables issue

Message ID 1517283178-36925-1-git-send-email-jingjing.wu@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Jingjing Wu Jan. 30, 2018, 3:32 a.m. UTC
  This patch fixes the coverity UNINIT issue.

Coverity issue: 257016, 257036
Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")

Reported-by: John McNamara <john.mcnamara@intel.com>
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---

v2 change:
 - add fix for 257016

 drivers/net/avf/avf_ethdev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Comments

Ferruh Yigit Jan. 31, 2018, 7:20 p.m. UTC | #1
On 1/30/2018 3:32 AM, Jingjing Wu wrote:
> This patch fixes the coverity UNINIT issue.
> 
> Coverity issue: 257016, 257036
> Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")
> 
> Reported-by: John McNamara <john.mcnamara@intel.com>
> Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>

Applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/drivers/net/avf/avf_ethdev.c b/drivers/net/avf/avf_ethdev.c
index cf7bbb2..7eacb8f 100644
--- a/drivers/net/avf/avf_ethdev.c
+++ b/drivers/net/avf/avf_ethdev.c
@@ -191,7 +191,7 @@  avf_init_rss(struct avf_adapter *adapter)
 				   vf->vf_res->rss_key_size));
 
 	/* init RSS LUT table */
-	for (i = 0; i < vf->vf_res->rss_lut_size; i++, j++) {
+	for (i = 0, j = 0; i < vf->vf_res->rss_lut_size; i++, j++) {
 		if (j >= nb_q)
 			j = 0;
 		vf->rss_lut[i] = j;
@@ -760,10 +760,10 @@  avf_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask)
 			err = avf_enable_vlan_strip(adapter);
 		else
 			err = avf_disable_vlan_strip(adapter);
-	}
 
-	if (err)
-		return -EIO;
+		if (err)
+			return -EIO;
+	}
 	return 0;
 }