Skip to contentSkip to conversation

ixgbevf: bug in error handling

DISCUSSION Dan Carpenter 2 participants 2 messages Mar 11, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi Greg,

drivers/net/ixgbevf/ixgbevf_main.c +3013 ixgbevf_tx_map(96) warn: unsigned 'i' is never less than zero.
3010 while (count >= 0) {

  3011                  count--;
  3012                  i--;
  3013                  if (i < 0)

3014 i += tx_ring->count;

There is a problem here because i is unsigned and just wraps around instead of being less than 0.

  3015                  tx_buffer_info = &tx_ring->tx_buffer_info[i];
  3016                  ixgbevf_unmap_and_free_tx_resource(adapter, tx_buffer_info);
  3017          }

regards,
dan carpenter

#1 lore raw
Quoted 20 lines

-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Thursday, March 11, 2010 2:33 AM
To: Rose, Gregory V
Cc: [email protected]; [email protected]
Subject: ixgbevf: bug in error handling

Hi Greg,

drivers/net/ixgbevf/ixgbevf_main.c +3013 ixgbevf_tx_map(96) warn:
unsigned 'i' is never less than zero.
3010 while (count >= 0) {

 3011                  count--;
 3012                  i--;
 3013                  if (i < 0)

3014 i += tx_ring->count;

There is a problem here because i is unsigned and just wraps around instead of being less than 0.

Quoted 7 lines

3015 tx_buffer_info = &tx_ring->tx_buffer_info[i];
3016 ixgbevf_unmap_and_free_tx_resource(adapter,
tx_buffer_info);
3017 }

regards,
dan carpenter

Ouch. Good catch, we'll fix that right away.

- Greg