提交 83840e4b 编写于 作者: J John W Linville 提交者: Jeff Kirsher

i40e: avoid use of uninitialized v_budget in i40e_init_msix

This I40E_FCOE block increments v_budget before it has been initialized,
then v_budget gets overwritten a few lines later.  This patch just
reorders the code hunks in what I believe was the intended sequence.

Coverity: CID 12600999Signed-off-by: NJohn W Linville <linville@tuxdriver.com>
Tested-by: NJim Young <james.m.young@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
上级 cf86da48
......@@ -6933,17 +6933,17 @@ static int i40e_init_msix(struct i40e_pf *pf)
if (pf->flags & I40E_FLAG_FD_SB_ENABLED)
other_vecs++;
/* Scale down if necessary, and the rings will share vectors */
pf->num_lan_msix = min_t(int, pf->num_lan_msix,
(hw->func_caps.num_msix_vectors - other_vecs));
v_budget = pf->num_lan_msix + other_vecs;
#ifdef I40E_FCOE
if (pf->flags & I40E_FLAG_FCOE_ENABLED) {
pf->num_fcoe_msix = pf->num_fcoe_qps;
v_budget += pf->num_fcoe_msix;
}
#endif
/* Scale down if necessary, and the rings will share vectors */
pf->num_lan_msix = min_t(int, pf->num_lan_msix,
(hw->func_caps.num_msix_vectors - other_vecs));
v_budget = pf->num_lan_msix + other_vecs;
pf->msix_entries = kcalloc(v_budget, sizeof(struct msix_entry),
GFP_KERNEL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册