netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Schmidt <mschmidt@redhat.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Miriam Shitrit <miris@broadcom.com>,
	Yuval Mintz <yuvalmin@broadcom.com>,
	Ariel Elior <ariele@broadcom.com>
Subject: [PATCH net 1/2] bnx2x: remove zeroing of dump data buffer
Date: Mon,  1 Jul 2013 17:23:05 +0200	[thread overview]
Message-ID: <1372692186-31032-2-git-send-email-mschmidt@redhat.com> (raw)
In-Reply-To: <1372692186-31032-1-git-send-email-mschmidt@redhat.com>

There is no need to initialize the dump data with zeros.
data is allocated with vzalloc, so it's already zero-filled.

More importantly, the memset is harmful, because dump->len (the length
requested by userspace) can be bigger than the allocated buffer (whose
size is determined by asking the driver's .get_dump_flag method).

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
index ce1a916..61ccae5 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
@@ -986,8 +986,6 @@ static int bnx2x_get_dump_data(struct net_device *dev,
 	struct bnx2x *bp = netdev_priv(dev);
 	struct dump_header dump_hdr = {0};
 
-	memset(p, 0, dump->len);
-
 	/* Disable parity attentions as long as following dump may
 	 * cause false alarms by reading never written registers. We
 	 * will re-enable parity attentions right after the dump.
-- 
1.8.1.4

  reply	other threads:[~2013-07-01 15:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-01 15:23 [PATCH net 0/2] bnx2x: ethtool dump fixes Michal Schmidt
2013-07-01 15:23 ` Michal Schmidt [this message]
2013-07-01 15:23 ` [PATCH net 2/2] bnx2x: fix dump flag handling Michal Schmidt
2013-07-02  7:16 ` [PATCH net 0/2] bnx2x: ethtool dump fixes 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=1372692186-31032-2-git-send-email-mschmidt@redhat.com \
    --to=mschmidt@redhat.com \
    --cc=ariele@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=miris@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=yuvalmin@broadcom.com \
    /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).