Commit 168d91cf authored by Mitch Williams's avatar Mitch Williams Committed by Jeff Kirsher

iavf: use signed variable

The counter variable in iavf_clean_tx_irq starts out negative and climbs
to 0. So allocating it as u16 is actually a really bad idea that just
happens to work because the value underflows and overflows consistently
on most architectures.

Replace the u16 with an int so signed math works as expected.
Signed-off-by: default avatarMitch Williams <mitch.a.williams@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent c2417a7b
...@@ -190,7 +190,7 @@ void iavf_detect_recover_hung(struct iavf_vsi *vsi) ...@@ -190,7 +190,7 @@ void iavf_detect_recover_hung(struct iavf_vsi *vsi)
static bool iavf_clean_tx_irq(struct iavf_vsi *vsi, static bool iavf_clean_tx_irq(struct iavf_vsi *vsi,
struct iavf_ring *tx_ring, int napi_budget) struct iavf_ring *tx_ring, int napi_budget)
{ {
u16 i = tx_ring->next_to_clean; int i = tx_ring->next_to_clean;
struct iavf_tx_buffer *tx_buf; struct iavf_tx_buffer *tx_buf;
struct iavf_tx_desc *tx_desc; struct iavf_tx_desc *tx_desc;
unsigned int total_bytes = 0, total_packets = 0; unsigned int total_bytes = 0, total_packets = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment