From: Rickard Strandqvist Date: Sun, 18 May 2014 16:02:57 +0000 (+0200) Subject: PCI: cpqphp: Fix possible null pointer dereference X-Git-Tag: firefly_0821_release~176^2~3767^2~6^2 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=cab9a128dad0fa0c8400a03d9375c781dda43982;p=firefly-linux-kernel-4.4.55.git PCI: cpqphp: Fix possible null pointer dereference There is otherwise a risk of a null pointer dereference. Found by cppcheck, a static code analysis program. Signed-off-by: Rickard Strandqvist Signed-off-by: Bjorn Helgaas --- diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c index 11845b796799..f593585f2784 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;