Skip to content

Commit

Permalink
PCI: cpqphp: Fix possible null pointer dereference
Browse files Browse the repository at this point in the history
There is otherwise a risk of a null pointer dereference.

Found by cppcheck, a static code analysis program.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
  • Loading branch information
Rickard Strandqvist authored and Bjorn Helgaas committed May 28, 2014
1 parent f0d54a5 commit cab9a12
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/pci/hotplug/cpqphp_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit cab9a12

Please sign in to comment.