net: ethernet: ibm: ehea: ehea_qmr.c: Fix for possible null pointer dereference

There is otherwise a risk of a possible null pointer dereference.

Was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Rickard Strandqvist 2014-05-18 18:01:21 +02:00 committed by David S. Miller
parent 71fd762f2e
commit 38ea4e6e4a

View File

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