[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1329307832-32454-7-git-send-email-yuvalmin@broadcom.com>
Date: Wed, 15 Feb 2012 07:10:27 -0500
From: "Yuval Mintz" <yuvalmin@...adcom.com>
To: davem@...emloft.net, netdev@...r.kernel.org
cc: eilong@...adcom.com, "Mintz Yuval" <yuvalmin@...adcom.com>,
"Merav Sicron" <meravs@...adcom.com>
Subject: [net-next 06/11] bnx2x: allocate memory dynamically in ethtool
self-test.
From: Mintz Yuval <yuvalmin@...adcom.com>
From: Merav Sicron <meravs@...adcom.com>
Current ethtool self tests usesa large buffer on stack. This patch replaces
that array by dynamically allocated memory
Signed-off-by: Merav Sicron <meravs@...adcom.com>
Signed-off-by: Eilon Greenstein <eilong@...adcom.com>
---
.../net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
index 4cbd474..c18dc1d 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
@@ -2016,14 +2016,22 @@ static int bnx2x_test_nvram(struct bnx2x *bp)
{ 0x708, 0x70 }, /* manuf_key_info */
{ 0, 0 }
};
- __be32 buf[0x350 / 4];
- u8 *data = (u8 *)buf;
+ __be32 *buf;
+ u8 *data;
int i, rc;
u32 magic, crc;
if (BP_NOMCP(bp))
return 0;
+ buf = kmalloc(0x350, GFP_KERNEL);
+ if (!buf) {
+ DP(NETIF_MSG_PROBE, "kmalloc failed\n");
+ rc = -ENOMEM;
+ goto test_nvram_exit;
+ }
+ data = (u8 *)buf;
+
rc = bnx2x_nvram_read(bp, 0, data, 4);
if (rc) {
DP(NETIF_MSG_PROBE, "magic value read (rc %d)\n", rc);
@@ -2057,6 +2065,7 @@ static int bnx2x_test_nvram(struct bnx2x *bp)
}
test_nvram_exit:
+ kfree(buf);
return rc;
}
--
1.7.9.rc2
--
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