linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] PCI: rcar: Add address check of mem_res
@ 2015-02-16  1:54 Nobuhiro Iwamatsu
  2015-02-16 14:01 ` Simon Horman
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Nobuhiro Iwamatsu @ 2015-02-16  1:54 UTC (permalink / raw)
  To: bhelgaas; +Cc: valentine.barshak, horms+renesas, linux-pci, Nobuhiro Iwamatsu

lower 16 bits of the address, which is managed by mem_res need to be 0.
This adds address check of lower 16 bits.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
---
 v2: Remove to before devm_kzalloc().

 drivers/pci/host/pci-rcar-gen2.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c
index d9c042f..e9617d3 100644
--- a/drivers/pci/host/pci-rcar-gen2.c
+++ b/drivers/pci/host/pci-rcar-gen2.c
@@ -346,6 +346,9 @@ static int rcar_pci_probe(struct platform_device *pdev)
 	if (!mem_res || !mem_res->start)
 		return -ENODEV;
 
+	if (mem_res->start & 0xFFFF)
+		return -EINVAL;
+
 	priv = devm_kzalloc(&pdev->dev,
 			    sizeof(struct rcar_pci_priv), GFP_KERNEL);
 	if (!priv)
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] PCI: rcar: Add address check of mem_res
  2015-02-16  1:54 [PATCH v2] PCI: rcar: Add address check of mem_res Nobuhiro Iwamatsu
@ 2015-02-16 14:01 ` Simon Horman
  2015-02-24  2:06 ` Simon Horman
  2015-02-24  6:26 ` Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2015-02-16 14:01 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu; +Cc: bhelgaas, valentine.barshak, linux-pci

On Mon, Feb 16, 2015 at 10:54:08AM +0900, Nobuhiro Iwamatsu wrote:
> lower 16 bits of the address, which is managed by mem_res need to be 0.
> This adds address check of lower 16 bits.
> 
> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>

Acked-by: Simon Horman <horms+renesas@verge.net.au>

> ---
>  v2: Remove to before devm_kzalloc().
> 
>  drivers/pci/host/pci-rcar-gen2.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c
> index d9c042f..e9617d3 100644
> --- a/drivers/pci/host/pci-rcar-gen2.c
> +++ b/drivers/pci/host/pci-rcar-gen2.c
> @@ -346,6 +346,9 @@ static int rcar_pci_probe(struct platform_device *pdev)
>  	if (!mem_res || !mem_res->start)
>  		return -ENODEV;
>  
> +	if (mem_res->start & 0xFFFF)
> +		return -EINVAL;
> +
>  	priv = devm_kzalloc(&pdev->dev,
>  			    sizeof(struct rcar_pci_priv), GFP_KERNEL);
>  	if (!priv)
> -- 
> 2.1.3
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] PCI: rcar: Add address check of mem_res
  2015-02-16  1:54 [PATCH v2] PCI: rcar: Add address check of mem_res Nobuhiro Iwamatsu
  2015-02-16 14:01 ` Simon Horman
@ 2015-02-24  2:06 ` Simon Horman
  2015-02-24  6:26 ` Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2015-02-24  2:06 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu; +Cc: bhelgaas, valentine.barshak, linux-pci

On Mon, Feb 16, 2015 at 10:54:08AM +0900, Nobuhiro Iwamatsu wrote:
> lower 16 bits of the address, which is managed by mem_res need to be 0.
> This adds address check of lower 16 bits.
> 
> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>

Acked-by: Simon Horman <horms+renesas@verge.net.au>

> ---
>  v2: Remove to before devm_kzalloc().
> 
>  drivers/pci/host/pci-rcar-gen2.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c
> index d9c042f..e9617d3 100644
> --- a/drivers/pci/host/pci-rcar-gen2.c
> +++ b/drivers/pci/host/pci-rcar-gen2.c
> @@ -346,6 +346,9 @@ static int rcar_pci_probe(struct platform_device *pdev)
>  	if (!mem_res || !mem_res->start)
>  		return -ENODEV;
>  
> +	if (mem_res->start & 0xFFFF)
> +		return -EINVAL;
> +
>  	priv = devm_kzalloc(&pdev->dev,
>  			    sizeof(struct rcar_pci_priv), GFP_KERNEL);
>  	if (!priv)
> -- 
> 2.1.3
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] PCI: rcar: Add address check of mem_res
  2015-02-16  1:54 [PATCH v2] PCI: rcar: Add address check of mem_res Nobuhiro Iwamatsu
  2015-02-16 14:01 ` Simon Horman
  2015-02-24  2:06 ` Simon Horman
@ 2015-02-24  6:26 ` Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2015-02-24  6:26 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu; +Cc: valentine.barshak, horms+renesas, linux-pci

On Mon, Feb 16, 2015 at 10:54:08AM +0900, Nobuhiro Iwamatsu wrote:
> lower 16 bits of the address, which is managed by mem_res need to be 0.
> This adds address check of lower 16 bits.
> 
> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>

Applied to pci/host-rcar for v4.1, thanks!

> ---
>  v2: Remove to before devm_kzalloc().
> 
>  drivers/pci/host/pci-rcar-gen2.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c
> index d9c042f..e9617d3 100644
> --- a/drivers/pci/host/pci-rcar-gen2.c
> +++ b/drivers/pci/host/pci-rcar-gen2.c
> @@ -346,6 +346,9 @@ static int rcar_pci_probe(struct platform_device *pdev)
>  	if (!mem_res || !mem_res->start)
>  		return -ENODEV;
>  
> +	if (mem_res->start & 0xFFFF)
> +		return -EINVAL;
> +
>  	priv = devm_kzalloc(&pdev->dev,
>  			    sizeof(struct rcar_pci_priv), GFP_KERNEL);
>  	if (!priv)
> -- 
> 2.1.3
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-24  6:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-16  1:54 [PATCH v2] PCI: rcar: Add address check of mem_res Nobuhiro Iwamatsu
2015-02-16 14:01 ` Simon Horman
2015-02-24  2:06 ` Simon Horman
2015-02-24  6:26 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).