summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Rabau <pr2345@gmail.com>2010-02-15 20:42:11 +0100
committerDavid S. Miller <davem@davemloft.net>2010-02-17 00:19:04 +0100
commitc9885fe5a76dea798543f2938a872bc159e8e69a (patch)
tree47d0d0f90753dc2179cd36e12825b0e608ed3c50
parentbnx2: Allow user-specified multiple advertisement speed values. (diff)
downloadlinux-c9885fe5a76dea798543f2938a872bc159e8e69a.tar.xz
linux-c9885fe5a76dea798543f2938a872bc159e8e69a.zip
bnx2: Fix bug when saving statistics.
This fixes the problem of dropping the carry when adding 2 32-bit values. Switch to use array indexing for better readability. Reported by and fix provided by Patrick Rabau. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/bnx2.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index d1e5e5d9e986..3fb110edad49 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -6555,16 +6555,16 @@ bnx2_save_stats(struct bnx2 *bp)
u32 hi;
u64 lo;
- hi = *(temp_stats + i) + *(hw_stats + i);
- lo = *(temp_stats + i + 1) + *(hw_stats + i + 1);
+ hi = temp_stats[i] + hw_stats[i];
+ lo = (u64) temp_stats[i + 1] + (u64) hw_stats[i + 1];
if (lo > 0xffffffff)
hi++;
- *(temp_stats + i) = hi;
- *(temp_stats + i + 1) = lo & 0xffffffff;
+ temp_stats[i] = hi;
+ temp_stats[i + 1] = lo & 0xffffffff;
}
for ( ; i < sizeof(struct statistics_block) / 4; i++)
- *(temp_stats + i) = *(temp_stats + i) + *(hw_stats + i);
+ temp_stats[i] += hw_stats[i];
}
#define GET_64BIT_NET_STATS64(ctr) \