diff options
author | Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> | 2014-05-18 18:01:21 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-18 21:26:02 -0400 |
commit | 38ea4e6e4a21fb88104be2a666a7e88176150b00 (patch) | |
tree | b795778f5775e067ba2a92db0ebc7d58025475c6 /drivers/net/ethernet/ibm | |
parent | 71fd762f2eef6acc848e262ac934fc694b49204e (diff) | |
download | blackbird-obmc-linux-38ea4e6e4a21fb88104be2a666a7e88176150b00.tar.gz blackbird-obmc-linux-38ea4e6e4a21fb88104be2a666a7e88176150b00.zip |
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>
Diffstat (limited to 'drivers/net/ethernet/ibm')
-rw-r--r-- | drivers/net/ethernet/ibm/ehea/ehea_qmr.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_qmr.c b/drivers/net/ethernet/ibm/ehea/ehea_qmr.c index 9b03033bb557..a0820f72b25c 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) |