linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pci: hotplug: cpqphp_ctrl.c:  Fix for possible null pointer dereference
@ 2014-05-18 16:02 Rickard Strandqvist
  2014-05-28  2:57 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Rickard Strandqvist @ 2014-05-18 16:02 UTC (permalink / raw)
  To: Bjorn Helgaas, Rickard Strandqvist
  Cc: Rafael J. Wysocki, Marta Rybczynska, linux-pci, 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/pci/hotplug/cpqphp_ctrl.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c
index 11845b7..a319d07 100644
--- a/drivers/pci/hotplug/cpqphp_ctrl.c
+++ b/drivers/pci/hotplug/cpqphp_ctrl.c
@@ -709,7 +709,8 @@ static struct pci_resource *get_max_resource(struct pci_resource **head, u32 siz
 				temp = temp->next;
 			}
 
-			temp->next = max->next;
+			if(temp)
+				temp->next = max->next;
 		}
 
 		max->next = NULL;
-- 
1.7.10.4


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

end of thread, other threads:[~2014-05-28  2:57 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:02 [PATCH] pci: hotplug: cpqphp_ctrl.c: Fix for possible null pointer dereference Rickard Strandqvist
2014-05-28  2:57 ` Bjorn Helgaas

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