netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Yuval Mintz" <yuvalmin@broadcom.com>
To: davem@davemloft.net, netdev@vger.kernel.org
Cc: eilong@broadcom.com, "Mintz Yuval" <yuvalmin@broadcom.com>,
	"Merav Sicron" <meravs@broadcom.com>
Subject: [net-next 06/11] bnx2x: allocate memory dynamically in ethtool self-test.
Date: Wed, 15 Feb 2012 07:10:27 -0500	[thread overview]
Message-ID: <1329307832-32454-7-git-send-email-yuvalmin@broadcom.com> (raw)
In-Reply-To: <1329307832-32454-1-git-send-email-yuvalmin@broadcom.com>

From: Mintz Yuval <yuvalmin@broadcom.com>

From: Merav Sicron <meravs@broadcom.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@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.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

  parent reply	other threads:[~2012-02-15  5:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-15 12:10 [net-next 00/11] bnx2x: feature patch series Yuval Mintz
2012-02-15 12:10 ` [net-next 01/11] bnx2x: consistent statistics after internal driver reload Yuval Mintz
2012-02-15 12:10 ` [net-next 02/11] bnx2x: half duplex support added for several boards Yuval Mintz
2012-02-15 12:10 ` [net-next 03/11] bnx2x: ethtool publishes link partners speed and FC Yuval Mintz
2012-02-15 12:10 ` [net-next 04/11] bnx2x: added autoneg-restart after link advertisement changes Yuval Mintz
2012-02-15 12:10 ` [net-next 05/11] bnx2x: force 10G on 84833 phy should be autoneg with only 10G advertised Yuval Mintz
2012-02-15 12:10 ` Yuval Mintz [this message]
2012-02-15 12:10 ` [net-next 07/11] bnx2x: allocate smaller Rx rings for 1G functions Yuval Mintz
2012-02-15 12:10 ` [net-next 08/11] bnx2x: notify cnic of address of info-to-the-mcp Yuval Mintz
2012-02-15 12:10 ` [net-next 09/11] bnx2x: allow BCM84833 phy to advertise 100Base-T speeds Yuval Mintz
2012-02-15 12:10 ` [net-next 10/11] bnx2x: removed code re-checking memory base after device open Yuval Mintz
2012-02-15 12:10 ` [net-next 11/11] bnx2x: allow all functions to display the phy FW version Yuval Mintz
2012-02-15 20:31 ` [net-next 00/11] bnx2x: feature patch series David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1329307832-32454-7-git-send-email-yuvalmin@broadcom.com \
    --to=yuvalmin@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=eilong@broadcom.com \
    --cc=meravs@broadcom.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).