Skip to content

Commit e6f7d27

Browse files
stonezdmbjorn-helgaas
authored andcommitted
PCI: of_property: Return error for int_map allocation failure
Return -ENOMEM from of_pci_prop_intr_map() if kcalloc() fails to prevent a NULL pointer dereference in this case. Fixes: 407d1a5 ("PCI: Create device tree node for bridge") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Duoming Zhou <[email protected]> [bhelgaas: commit log] Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent 4cece76 commit e6f7d27

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/pci/of_property.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ static int of_pci_prop_intr_map(struct pci_dev *pdev, struct of_changeset *ocs,
238238
return 0;
239239

240240
int_map = kcalloc(map_sz, sizeof(u32), GFP_KERNEL);
241+
if (!int_map)
242+
return -ENOMEM;
241243
mapp = int_map;
242244

243245
list_for_each_entry(child, &pdev->subordinate->devices, bus_list) {

0 commit comments

Comments
 (0)