diff options
author | Roopa Prabhu <roprabhu@cisco.com> | 2010-08-10 14:55:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-08-17 05:32:58 -0400 |
commit | 832177901a61aeda1f2122e323c39881ec84af65 (patch) | |
tree | 4df41abbabfefc6fcd9eb32c389f36a12a8fd4f2 | |
parent | ce16cc02f9fe21d4e42116305e5ea9d12e51635d (diff) |
enic: Check if rq/wq buf not NULL before freeing them
Signed-off-by: Scott Feldman <scofeldm@cisco.com>
Signed-off-by: Roopa Prabhu <roprabhu@cisco.com>
Signed-off-by: Vasanthy Kolluri <vkolluri@cisco.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/enic/vnic_rq.c | 6 | ||||
-rw-r--r-- | 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 dbb2aca258b9..b236d7cbc137 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) | |||
77 | vnic_dev_free_desc_ring(vdev, &rq->ring); | 77 | vnic_dev_free_desc_ring(vdev, &rq->ring); |
78 | 78 | ||
79 | for (i = 0; i < VNIC_RQ_BUF_BLKS_MAX; i++) { | 79 | for (i = 0; i < VNIC_RQ_BUF_BLKS_MAX; i++) { |
80 | kfree(rq->bufs[i]); | 80 | if (rq->bufs[i]) { |
81 | rq->bufs[i] = NULL; | 81 | kfree(rq->bufs[i]); |
82 | rq->bufs[i] = NULL; | ||
83 | } | ||
82 | } | 84 | } |
83 | 85 | ||
84 | rq->ctrl = NULL; | 86 | rq->ctrl = NULL; |
diff --git a/drivers/net/enic/vnic_wq.c b/drivers/net/enic/vnic_wq.c index 122e33bcc578..4b2a6c6a569b 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) | |||
77 | vnic_dev_free_desc_ring(vdev, &wq->ring); | 77 | vnic_dev_free_desc_ring(vdev, &wq->ring); |
78 | 78 | ||
79 | for (i = 0; i < VNIC_WQ_BUF_BLKS_MAX; i++) { | 79 | for (i = 0; i < VNIC_WQ_BUF_BLKS_MAX; i++) { |
80 | kfree(wq->bufs[i]); | 80 | if (wq->bufs[i]) { |
81 | wq->bufs[i] = NULL; | 81 | kfree(wq->bufs[i]); |
82 | wq->bufs[i] = NULL; | ||
83 | } | ||
82 | } | 84 | } |
83 | 85 | ||
84 | wq->ctrl = NULL; | 86 | wq->ctrl = NULL; |