Re: [PATCH] PCI: keystone: Don't dereference possible NULL pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/09/2015 03:45 PM, Bjorn Helgaas wrote:
Check for failure from platform_get_resource() (this check actually happens
inside devm_ioremap_resource()) before dereferencing the pointer returned
from platform_get_resource().

Signed-off-by: Bjorn Helgaas<bhelgaas@xxxxxxxxxx>
---
  drivers/pci/host/pci-keystone-dw.c |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/host/pci-keystone-dw.c b/drivers/pci/host/pci-keystone-dw.c
index 66d8ea41b972..f34892e0edb4 100644
--- a/drivers/pci/host/pci-keystone-dw.c
+++ b/drivers/pci/host/pci-keystone-dw.c
@@ -496,11 +496,12 @@ int __init ks_dw_pcie_host_init(struct keystone_pcie *ks_pcie,

  	/* Index 1 is the application reg. space address */
  	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	ks_pcie->app = *res;
  	ks_pcie->va_app_base = devm_ioremap_resource(pp->dev, res);
  	if (IS_ERR(ks_pcie->va_app_base))
  		return PTR_ERR(ks_pcie->va_app_base);

+	ks_pcie->app = *res;
+
  	/* Create legacy IRQ domain */
  	ks_pcie->legacy_irq_domain =
  			irq_domain_add_linear(ks_pcie->legacy_intc_np,

Bjorn,

Thanks for fixing this.

Acked-By: Murali Karicheri <m-karicheri2@xxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux