netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ehea: Fix possible NULL pointer dereference
@ 2013-02-24 22:59 Syam Sidhardhan
  2013-02-25 12:09 ` Thadeu Lima de Souza Cascardo
  0 siblings, 1 reply; 2+ messages in thread
From: Syam Sidhardhan @ 2013-02-24 22:59 UTC (permalink / raw)
  To: netdev; +Cc: syamsidhardh, cascardo

Check for (queue == NULL) has to be done before accessing queue.

Signed-off-by: Syam Sidhardhan <s.syam@samsung.com>
---
 drivers/net/ethernet/ibm/ehea/ehea_qmr.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ehea/ehea_qmr.c b/drivers/net/ethernet/ibm/ehea/ehea_qmr.c
index 9b03033..a0820f7 100644
--- a/drivers/net/ethernet/ibm/ehea/ehea_qmr.c
+++ b/drivers/net/ethernet/ibm/ehea/ehea_qmr.c
@@ -103,12 +103,14 @@ out_nomem:
 
 static void hw_queue_dtor(struct hw_queue *queue)
 {
-	int pages_per_kpage = PAGE_SIZE / queue->pagesize;
+	int pages_per_kpage;
 	int i, nr_pages;
 
 	if (!queue || !queue->queue_pages)
 		return;
 
+	pages_per_kpage = PAGE_SIZE / queue->pagesize;
+
 	nr_pages = queue->queue_length / queue->pagesize;
 
 	for (i = 0; i < nr_pages; i += pages_per_kpage)
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-25 12:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-24 22:59 [PATCH] ehea: Fix possible NULL pointer dereference Syam Sidhardhan
2013-02-25 12:09 ` Thadeu Lima de Souza Cascardo

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).