netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix possible null pointer dereference in ehea_qmr.c
@ 2011-03-14  7:46 huzaifas
  2011-03-14 22:34 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: huzaifas @ 2011-03-14  7:46 UTC (permalink / raw)
  To: netdev; +Cc: leitao, Huzaifa Sidhpurwala

From: Huzaifa Sidhpurwala <huzaifas@redhat.com>

If queue is zero, dont reference it

Signed-off-by: Huzaifa Sidhpurwala <huzaifas@redhat.com>
---
 drivers/net/ehea/ehea_qmr.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ehea/ehea_qmr.c b/drivers/net/ehea/ehea_qmr.c
index cd44bb8..fd0815d 100644
--- a/drivers/net/ehea/ehea_qmr.c
+++ b/drivers/net/ehea/ehea_qmr.c
@@ -106,12 +106,13 @@ 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.3.4

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

* Re: [PATCH] Fix possible null pointer dereference in ehea_qmr.c
  2011-03-14  7:46 [PATCH] Fix possible null pointer dereference in ehea_qmr.c huzaifas
@ 2011-03-14 22:34 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-03-14 22:34 UTC (permalink / raw)
  To: huzaifas; +Cc: netdev, leitao

From: huzaifas@redhat.com
Date: Mon, 14 Mar 2011 13:16:04 +0530

> From: Huzaifa Sidhpurwala <huzaifas@redhat.com>
> 
> If queue is zero, dont reference it
> 
> Signed-off-by: Huzaifa Sidhpurwala <huzaifas@redhat.com>

There is no code path where hw_queue_dtor() is called with a NULL
"queue".  I've checked all of the code paths.

Therefore it's better to simply remove the NULL check.

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

end of thread, other threads:[~2011-03-14 22:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-14  7:46 [PATCH] Fix possible null pointer dereference in ehea_qmr.c huzaifas
2011-03-14 22:34 ` David Miller

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