Skip to content

Commit

Permalink
i40evf: fix off-by-one
Browse files Browse the repository at this point in the history
The loop in i40evf_get_rxfh_indir was only reading fifteen registers,
not all sixteen. Change the matching loop in i40evf_set_rxfh_indir at
the same time to make the code more consistent.

Change-ID: I6c182287698e742d1f6ca1a4bcc43cc08df6e1de
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
  • Loading branch information
Mitch Williams authored and Jeff Kirsher committed Jun 20, 2014
1 parent e57a2fe commit cc70b08
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ static int i40evf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key)
u32 hlut_val;
int i, j;

for (i = 0, j = 0; i < I40E_VFQF_HLUT_MAX_INDEX; i++) {
for (i = 0, j = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; i++) {
hlut_val = rd32(hw, I40E_VFQF_HLUT(i));
indir[j++] = hlut_val & 0xff;
indir[j++] = (hlut_val >> 8) & 0xff;
Expand All @@ -659,7 +659,7 @@ static int i40evf_set_rxfh(struct net_device *netdev, const u32 *indir,
u32 hlut_val;
int i, j;

for (i = 0, j = 0; i < I40E_VFQF_HLUT_MAX_INDEX + 1; i++) {
for (i = 0, j = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; i++) {
hlut_val = indir[j++];
hlut_val |= indir[j++] << 8;
hlut_val |= indir[j++] << 16;
Expand Down

0 comments on commit cc70b08

Please sign in to comment.