Skip to content

Commit

Permalink
bnx2x: fix occasional statistics off-by-4GB error
Browse files Browse the repository at this point in the history
The UPDATE_QSTAT function introduced on February 15, 2012
in commit 1355b70 "bnx2x: consistent statistics after
internal driver reload" incorrectly fails to handle overflow
during addition of the lower 32-bit field of a stat.

This bug is present since 3.4-rc1 and should thus be considered
a candidate for stable 3.4+ releases.

Google-Bug-Id: 8374428
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Cc: Mintz Yuval <yuvalmin@broadcom.com>
Acked-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Maciej Żenczykowski authored and David S. Miller committed Mar 18, 2013
1 parent 46aa92d commit b009aac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,9 @@ struct bnx2x_fw_port_stats_old {

#define UPDATE_QSTAT(s, t) \
do { \
qstats->t##_hi = qstats_old->t##_hi + le32_to_cpu(s.hi); \
qstats->t##_lo = qstats_old->t##_lo + le32_to_cpu(s.lo); \
qstats->t##_hi = qstats_old->t##_hi + le32_to_cpu(s.hi) \
+ ((qstats->t##_lo < qstats_old->t##_lo) ? 1 : 0); \
} while (0)

#define UPDATE_QSTAT_OLD(f) \
Expand Down

0 comments on commit b009aac

Please sign in to comment.