Skip to content

Commit

Permalink
net: ethernet: ibm: ehea: ehea_qmr.c: Fix for possible null pointer d…
Browse files Browse the repository at this point in the history
…ereference

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>
  • Loading branch information
Rickard Strandqvist authored and David S. Miller committed May 19, 2014
1 parent 71fd762 commit 38ea4e6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/ethernet/ibm/ehea/ehea_qmr.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,14 @@ static int hw_queue_ctor(struct hw_queue *queue, const u32 nr_of_pages,

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)
Expand Down

0 comments on commit 38ea4e6

Please sign in to comment.