Skip to content

Commit

Permalink
i40e: fix condition of WARN_ONCE for stat strings
Browse files Browse the repository at this point in the history
Commit 9b10df5 ("i40e: use WARN_ONCE to replace the commented
BUG_ON size check") introduced a warning check to make sure
that the size of the stat strings was always the expected value. This
code accidentally inverted the check of the data pointer. Fix this so
that we accurately count the size of the stats we copied in.

This fixes an erroneous WARN kernel splat that occurs when requesting
ethtool statistics.

Signed-off-by: Jacob Keller <[email protected]>
Tested-by: Andrew Bowers <[email protected]>
Tested-by: Mauro S M Rodrigues <[email protected]>
Signed-off-by: Jeff Kirsher <[email protected]>
  • Loading branch information
jacob-keller authored and Jeff Kirsher committed Aug 24, 2018
1 parent fa38e30 commit 07f3701
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/intel/i40e/i40e_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -2013,7 +2013,7 @@ static void i40e_get_stat_strings(struct net_device *netdev, u8 *data)
for (i = 0; i < I40E_MAX_USER_PRIORITY; i++)
i40e_add_stat_strings(&data, i40e_gstrings_pfc_stats, i);

WARN_ONCE(p - data != i40e_get_stats_count(netdev) * ETH_GSTRING_LEN,
WARN_ONCE(data - p != i40e_get_stats_count(netdev) * ETH_GSTRING_LEN,
"stat strings count mismatch!");
}

Expand Down

0 comments on commit 07f3701

Please sign in to comment.