netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ethernet: ibm: ehea: ehea_qmr.c:  Fix for possible null pointer dereference
@ 2014-05-18 16:01 Rickard Strandqvist
  2014-05-19  1:26 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Rickard Strandqvist @ 2014-05-18 16:01 UTC (permalink / raw)
  To: Thadeu Lima de Souza Cascardo, netdev; +Cc: Rickard Strandqvist, linux-kernel

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>
---
 drivers/net/ethernet/ibm/ehea/ehea_qmr.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ehea/ehea_qmr.c b/drivers/net/ethernet/ibm/ehea/ehea_qmr.c
index 9b03033..a0820f7 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)
-- 
1.7.10.4

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

* Re: [PATCH] net: ethernet: ibm: ehea: ehea_qmr.c: Fix for possible null pointer dereference
  2014-05-18 16:01 [PATCH] net: ethernet: ibm: ehea: ehea_qmr.c: Fix for possible null pointer dereference Rickard Strandqvist
@ 2014-05-19  1:26 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-05-19  1:26 UTC (permalink / raw)
  To: rickard_strandqvist; +Cc: cascardo, netdev, linux-kernel

From: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Date: Sun, 18 May 2014 18:01:21 +0200

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

Applied, thanks.

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

end of thread, other threads:[~2014-05-19  1:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-18 16:01 [PATCH] net: ethernet: ibm: ehea: ehea_qmr.c: Fix for possible null pointer dereference Rickard Strandqvist
2014-05-19  1:26 ` 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).