[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1266298932-28129-5-git-send-email-mchan@broadcom.com>
Date: Mon, 15 Feb 2010 21:42:11 -0800
From: "Michael Chan" <mchan@...adcom.com>
To: davem@...emloft.net
cc: netdev@...r.kernel.org
Subject: [PATCH -next 5/6] bnx2: Fix bug when saving statistics.
From: Patrick Rabau <pr2345@...il.com>
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@...adcom.com>
Signed-off-by: Benjamin Li <benli@...adcom.com>
---
drivers/net/bnx2.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 2c75fd7..dda815a 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) \
--
1.6.4.GIT
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists