Netdev List
 help / color / mirror / Atom feed
From: Roopa Prabhu <roprabhu@cisco.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [net-next-2.6 PATCH 6/7] enic: Check if rq/wq buf not NULL before freeing them
Date: Tue, 10 Aug 2010 21:55:20 -0700	[thread overview]
Message-ID: <20100811045520.3877.54012.stgit@savbu-pc100.cisco.com> (raw)
In-Reply-To: <20100811045436.3877.51650.stgit@savbu-pc100.cisco.com>

From: Roopa Prabhu <roprabhu@cisco.com>



Signed-off-by: Scott Feldman <scofeldm@cisco.com>
Signed-off-by: Roopa Prabhu <roprabhu@cisco.com>
Signed-off-by: Vasanthy Kolluri <vkolluri@cisco.com>
---
 drivers/net/enic/vnic_rq.c |    6 ++++--
 drivers/net/enic/vnic_wq.c |    6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)


diff --git a/drivers/net/enic/vnic_rq.c b/drivers/net/enic/vnic_rq.c
index dbb2aca..b236d7c 100644
--- a/drivers/net/enic/vnic_rq.c
+++ b/drivers/net/enic/vnic_rq.c
@@ -77,8 +77,10 @@ void vnic_rq_free(struct vnic_rq *rq)
 	vnic_dev_free_desc_ring(vdev, &rq->ring);
 
 	for (i = 0; i < VNIC_RQ_BUF_BLKS_MAX; i++) {
-		kfree(rq->bufs[i]);
-		rq->bufs[i] = NULL;
+		if (rq->bufs[i]) {
+			kfree(rq->bufs[i]);
+			rq->bufs[i] = NULL;
+		}
 	}
 
 	rq->ctrl = NULL;
diff --git a/drivers/net/enic/vnic_wq.c b/drivers/net/enic/vnic_wq.c
index 122e33b..4b2a6c6 100644
--- a/drivers/net/enic/vnic_wq.c
+++ b/drivers/net/enic/vnic_wq.c
@@ -77,8 +77,10 @@ void vnic_wq_free(struct vnic_wq *wq)
 	vnic_dev_free_desc_ring(vdev, &wq->ring);
 
 	for (i = 0; i < VNIC_WQ_BUF_BLKS_MAX; i++) {
-		kfree(wq->bufs[i]);
-		wq->bufs[i] = NULL;
+		if (wq->bufs[i]) {
+			kfree(wq->bufs[i]);
+			wq->bufs[i] = NULL;
+		}
 	}
 
 	wq->ctrl = NULL;


  parent reply	other threads:[~2010-08-11  4:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-11  4:54 [net-next-2.6 PATCH 0/7] enic: updates to version 1.4.1.2 Roopa Prabhu
2010-08-11  4:54 ` [net-next-2.6 PATCH 1/7] enic: Add set mac address Roopa Prabhu
2010-08-11  4:55 ` [net-next-2.6 PATCH 2/7] enic: Add support for firmware management device Roopa Prabhu
2010-08-11  4:55 ` [net-next-2.6 PATCH 3/7] enic: Add new firmware devcmds Roopa Prabhu
2010-08-11  4:55 ` [net-next-2.6 PATCH 4/7] enic: Use offsetof macro in vic tlv length calculation Roopa Prabhu
2010-08-11  4:55 ` [net-next-2.6 PATCH 5/7] enic: Clean up: remove enic_dev_stats_clear Roopa Prabhu
2010-08-11  4:55 ` Roopa Prabhu [this message]
2010-08-11  4:55 ` [net-next-2.6 PATCH 7/7] enic: Mark intr_timer in vnic_enet_config as deprecated Roopa Prabhu
2010-08-17  9:35 ` [net-next-2.6 PATCH 0/7] enic: updates to version 1.4.1.2 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=20100811045520.3877.54012.stgit@savbu-pc100.cisco.com \
    --to=roprabhu@cisco.com \
    --cc=davem@davemloft.net \
    --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