Message ID | 20180820151233.14629-6-alice.michael@intel.com |
---|---|
State | Accepted |
Delegated to: | Jeff Kirsher |
Headers | show |
Series | None | expand |
> -----Original Message----- > From: Intel-wired-lan [mailto:intel-wired-lan-bounces@osuosl.org] On > Behalf Of Alice Michael > Sent: Monday, August 20, 2018 8:12 AM > To: Michael, Alice <alice.michael@intel.com>; intel-wired- > lan@lists.osuosl.org > Subject: [Intel-wired-lan] [next PATCH S95 06/12] i40e: fix condition of > WARN_ONCE for stat strings > > From: Jacob Keller <jacob.e.keller@intel.com> > > Commit 9b10df596bd4 ("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 <jacob.e.keller@intel.com> > --- > drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
On Mon, Aug 20, 2018 at 08:12:27AM -0700, Alice Michael wrote: > From: Jacob Keller <jacob.e.keller@intel.com> > > Commit 9b10df596bd4 ("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 <jacob.e.keller@intel.com> > --- > drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > Tested-by: Mauro S. M. Rodrigues <maurosr@linux.vnet.ibm.com>
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c index ecc30524..3ef9069 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c @@ -1863,7 +1863,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!"); }