From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Jacob Keller <jacob.e.keller@intel.com>,
netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
Andrew Bowers <andrewx.bowers@intel.com>,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 8/9] i40e: verify string count matches even on early return
Date: Thu, 1 Aug 2019 13:51:48 -0700 [thread overview]
Message-ID: <20190801205149.4114-9-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <20190801205149.4114-1-jeffrey.t.kirsher@intel.com>
From: Jacob Keller <jacob.e.keller@intel.com>
Similar to i40e_get_ethtool_stats, add a goto to verify that the data
pointer for the strings lines up with the expected stats count. This
helps ensure that bugs are not introduced when adding stats.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index ceca57a261dc..01e4615b1b4b 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -2342,7 +2342,7 @@ static void i40e_get_stat_strings(struct net_device *netdev, u8 *data)
}
if (vsi != pf->vsi[pf->lan_vsi] || pf->hw.partition_id != 1)
- return;
+ goto check_data_pointer;
i40e_add_stat_strings(&data, i40e_gstrings_veb_stats);
@@ -2354,6 +2354,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);
+check_data_pointer:
WARN_ONCE(data - p != i40e_get_stats_count(netdev) * ETH_GSTRING_LEN,
"stat strings count mismatch!");
}
--
2.21.0
next prev parent reply other threads:[~2019-08-01 20:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-01 20:51 [net-next 0/9][pull request] 40GbE Intel Wired LAN Driver Updates 2019-08-01 Jeff Kirsher
2019-08-01 20:51 ` [net-next 1/9] i40e: fix incorrect ethtool statistics veb and veb.tc_ Jeff Kirsher
2019-08-01 20:51 ` [net-next 2/9] i40e: make visible changed vf mac on host Jeff Kirsher
2019-08-02 0:11 ` Shannon Nelson
2019-08-02 8:14 ` Loktionov, Aleksandr
2019-08-02 17:00 ` Shannon Nelson
2019-08-01 20:51 ` [net-next 3/9] i40e: Log disable-fw-lldp flag change by ethtool Jeff Kirsher
2019-08-01 20:51 ` [net-next 4/9] i40e: don't report link up for a VF who hasn't enabled queues Jeff Kirsher
2019-08-01 20:51 ` [net-next 5/9] i40e: fix code comments Jeff Kirsher
2019-08-01 20:51 ` [net-next 6/9] i40e: Update visual effect for advertised FEC mode Jeff Kirsher
2019-08-01 20:51 ` [net-next 7/9] i40e: Log info when PF is entering and leaving Allmulti mode Jeff Kirsher
2019-08-01 20:51 ` Jeff Kirsher [this message]
2019-08-01 20:51 ` [net-next 9/9] i40e: Remove unicast log when VF is leaving multicast mode Jeff Kirsher
2019-08-03 17:46 ` [net-next 0/9][pull request] 40GbE Intel Wired LAN Driver Updates 2019-08-01 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190801205149.4114-9-jeffrey.t.kirsher@intel.com \
--to=jeffrey.t.kirsher@intel.com \
--cc=andrewx.bowers@intel.com \
--cc=davem@davemloft.net \
--cc=jacob.e.keller@intel.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@redhat.com \
--cc=sassmann@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox