Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Rickard Strandqvist and committed by
David S. Miller
38ea4e6e 71fd762f

+3 -1
+3 -1
drivers/net/ethernet/ibm/ehea/ehea_qmr.c
··· 103 103 104 104 static void hw_queue_dtor(struct hw_queue *queue) 105 105 { 106 - int pages_per_kpage = PAGE_SIZE / queue->pagesize; 106 + int pages_per_kpage; 107 107 int i, nr_pages; 108 108 109 109 if (!queue || !queue->queue_pages) 110 110 return; 111 + 112 + pages_per_kpage = PAGE_SIZE / queue->pagesize; 111 113 112 114 nr_pages = queue->queue_length / queue->pagesize; 113 115