* [PATCH 1/2] e1000: fix memcpy in e1000_get_strings
@ 2007-12-05 19:57 Auke Kok
2007-12-05 19:57 ` [PATCH 2/2] e100: cleanup unneeded math Auke Kok
2007-12-07 20:03 ` [PATCH 1/2] e1000: fix memcpy in e1000_get_strings Jeff Garzik
0 siblings, 2 replies; 3+ messages in thread
From: Auke Kok @ 2007-12-05 19:57 UTC (permalink / raw)
To: jeff; +Cc: netdev, 12o3l
From: Roel Kluin <12o3l@tiscali.nl>
drivers/net/e1000/e1000_ethtool.c:113:
#define E1000_TEST_LEN sizeof(e1000_gstrings_test) / ETH_GSTRING_LEN
drivers/net/e1000e/ethtool.c:106:
#define E1000_TEST_LEN sizeof(e1000_gstrings_test) / ETH_GSTRING_LEN
E1000_TEST_LEN*ETH_GSTRING_LEN will expand to
sizeof(e1000_gstrings_test) / (ETH_GSTRING_LEN * ETH_GSTRING_LEN)
A lack of parentheses around defines causes unexpected results due to
operator precedences.
Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
---
drivers/net/e1000/e1000_ethtool.c | 2 +-
drivers/net/e1000e/ethtool.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index 0542b10..d876787 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -1949,7 +1949,7 @@ e1000_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data)
switch (stringset) {
case ETH_SS_TEST:
memcpy(data, *e1000_gstrings_test,
- E1000_TEST_LEN*ETH_GSTRING_LEN);
+ sizeof(e1000_gstrings_test));
break;
case ETH_SS_STATS:
for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) {
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index d824914..6d9c27f 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -1760,7 +1760,7 @@ static void e1000_get_strings(struct net_device *netdev, u32 stringset,
switch (stringset) {
case ETH_SS_TEST:
memcpy(data, *e1000_gstrings_test,
- E1000_TEST_LEN*ETH_GSTRING_LEN);
+ sizeof(e1000_gstrings_test));
break;
case ETH_SS_STATS:
for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) {
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] e100: cleanup unneeded math
2007-12-05 19:57 [PATCH 1/2] e1000: fix memcpy in e1000_get_strings Auke Kok
@ 2007-12-05 19:57 ` Auke Kok
2007-12-07 20:03 ` [PATCH 1/2] e1000: fix memcpy in e1000_get_strings Jeff Garzik
1 sibling, 0 replies; 3+ messages in thread
From: Auke Kok @ 2007-12-05 19:57 UTC (permalink / raw)
To: jeff; +Cc: netdev, 12o3l
No need to convert to bytes and back - cleanup unneeded code.
Adapted from fix from 'Roel Kluin <12o3l@tiscali.nl>'
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
---
drivers/net/e100.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 9189aff..27f4d4a 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -2284,13 +2284,11 @@ static void e100_get_drvinfo(struct net_device *netdev,
strcpy(info->bus_info, pci_name(nic->pdev));
}
+#define E100_PHY_REGS 0x1C
static int e100_get_regs_len(struct net_device *netdev)
{
struct nic *nic = netdev_priv(netdev);
-#define E100_PHY_REGS 0x1C
-#define E100_REGS_LEN 1 + E100_PHY_REGS + \
- sizeof(nic->mem->dump_buf) / sizeof(u32)
- return E100_REGS_LEN * sizeof(u32);
+ return 1 + E100_PHY_REGS + sizeof(nic->mem->dump_buf);
}
static void e100_get_regs(struct net_device *netdev,
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] e1000: fix memcpy in e1000_get_strings
2007-12-05 19:57 [PATCH 1/2] e1000: fix memcpy in e1000_get_strings Auke Kok
2007-12-05 19:57 ` [PATCH 2/2] e100: cleanup unneeded math Auke Kok
@ 2007-12-07 20:03 ` Jeff Garzik
1 sibling, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2007-12-07 20:03 UTC (permalink / raw)
To: Auke Kok; +Cc: netdev, 12o3l
Auke Kok wrote:
> From: Roel Kluin <12o3l@tiscali.nl>
>
> drivers/net/e1000/e1000_ethtool.c:113:
> #define E1000_TEST_LEN sizeof(e1000_gstrings_test) / ETH_GSTRING_LEN
>
> drivers/net/e1000e/ethtool.c:106:
> #define E1000_TEST_LEN sizeof(e1000_gstrings_test) / ETH_GSTRING_LEN
>
> E1000_TEST_LEN*ETH_GSTRING_LEN will expand to
> sizeof(e1000_gstrings_test) / (ETH_GSTRING_LEN * ETH_GSTRING_LEN)
>
> A lack of parentheses around defines causes unexpected results due to
> operator precedences.
>
> Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
> Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
> ---
>
> drivers/net/e1000/e1000_ethtool.c | 2 +-
> drivers/net/e1000e/ethtool.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
applied 1-2 to #upstream-fixes
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-12-07 20:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-05 19:57 [PATCH 1/2] e1000: fix memcpy in e1000_get_strings Auke Kok
2007-12-05 19:57 ` [PATCH 2/2] e100: cleanup unneeded math Auke Kok
2007-12-07 20:03 ` [PATCH 1/2] e1000: fix memcpy in e1000_get_strings Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).