Message ID | 20180122022854.3634-1-jh80.chung@samsung.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
On Sunday, January 21, 2018 6:29 PM, Jaehoon Chung wrote: > > Before calling the callback function, it needs to check whether > init_clk_resources is assigned or not. > Otherwise, it can be occurred the NULL pointer dereference when > init_clk_resources is not assigned. > > Even though init_clk_resources is assigned now, it needs to prevent the > potential NULL pointer dereference in future. > > Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Acked-by: Jingoo Han <jingoohan1@gmail.com> Best regards, Jingoo Han > --- > drivers/pci/dwc/pci-exynos.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/dwc/pci-exynos.c b/drivers/pci/dwc/pci-exynos.c > index 56f32aeebd0a..39f08881f9a4 100644 > --- a/drivers/pci/dwc/pci-exynos.c > +++ b/drivers/pci/dwc/pci-exynos.c > @@ -499,7 +499,8 @@ static int __init exynos_pcie_probe(struct > platform_device *pdev) > return ret; > } > > - if (ep->ops && ep->ops->get_clk_resources) { > + if (ep->ops && ep->ops->get_clk_resources && > + ep->ops->init_clk_resources) { > ret = ep->ops->get_clk_resources(ep); > if (ret) > return ret; > -- > 2.15.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Jan 22, 2018 at 11:28:54AM +0900, Jaehoon Chung wrote: > Before calling the callback function, it needs to check whether > init_clk_resources is assigned or not. > Otherwise, it can be occurred the NULL pointer dereference when > init_clk_resources is not assigned. > > Even though init_clk_resources is assigned now, it needs to prevent the > potential NULL pointer dereference in future. > > Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> > --- > drivers/pci/dwc/pci-exynos.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/dwc/pci-exynos.c b/drivers/pci/dwc/pci-exynos.c > index 56f32aeebd0a..39f08881f9a4 100644 > --- a/drivers/pci/dwc/pci-exynos.c > +++ b/drivers/pci/dwc/pci-exynos.c > @@ -499,7 +499,8 @@ static int __init exynos_pcie_probe(struct platform_device *pdev) > return ret; > } > > - if (ep->ops && ep->ops->get_clk_resources) { > + if (ep->ops && ep->ops->get_clk_resources && > + ep->ops->init_clk_resources) { > ret = ep->ops->get_clk_resources(ep); > if (ret) > return ret; > -- > 2.15.1 I applied it to pci/dwc for 4.16. Thanks, Lorenzo -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/pci/dwc/pci-exynos.c b/drivers/pci/dwc/pci-exynos.c index 56f32aeebd0a..39f08881f9a4 100644 --- a/drivers/pci/dwc/pci-exynos.c +++ b/drivers/pci/dwc/pci-exynos.c @@ -499,7 +499,8 @@ static int __init exynos_pcie_probe(struct platform_device *pdev) return ret; } - if (ep->ops && ep->ops->get_clk_resources) { + if (ep->ops && ep->ops->get_clk_resources && + ep->ops->init_clk_resources) { ret = ep->ops->get_clk_resources(ep); if (ret) return ret;
Before calling the callback function, it needs to check whether init_clk_resources is assigned or not. Otherwise, it can be occurred the NULL pointer dereference when init_clk_resources is not assigned. Even though init_clk_resources is assigned now, it needs to prevent the potential NULL pointer dereference in future. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> --- drivers/pci/dwc/pci-exynos.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)