linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: rcar: Add address check of mem_res
@ 2015-02-13  7:55 Nobuhiro Iwamatsu
  2015-02-13 16:44 ` Simon Horman
  0 siblings, 1 reply; 3+ messages in thread
From: Nobuhiro Iwamatsu @ 2015-02-13  7:55 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>
---
 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..13b2793 100644
--- a/drivers/pci/host/pci-rcar-gen2.c
+++ b/drivers/pci/host/pci-rcar-gen2.c
@@ -351,6 +351,9 @@ static int rcar_pci_probe(struct platform_device *pdev)
 	if (!priv)
 		return -ENOMEM;
 
+	if (mem_res->start & 0xFFFF)
+		return -EINVAL;
+
 	priv->mem_res = *mem_res;
 	/*
 	 * The controller does not support/use port I/O,
-- 
2.1.3


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

* Re: [PATCH] PCI: rcar: Add address check of mem_res
  2015-02-13  7:55 [PATCH] PCI: rcar: Add address check of mem_res Nobuhiro Iwamatsu
@ 2015-02-13 16:44 ` Simon Horman
  2015-02-16  1:53   ` Nobuhiro Iwamatsu
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Horman @ 2015-02-13 16:44 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu; +Cc: bhelgaas, valentine.barshak, linux-pci

Hi Iwamatsu-san,

On Fri, Feb 13, 2015 at 04:55:38PM +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>
> ---
>  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..13b2793 100644
> --- a/drivers/pci/host/pci-rcar-gen2.c
> +++ b/drivers/pci/host/pci-rcar-gen2.c
> @@ -351,6 +351,9 @@ static int rcar_pci_probe(struct platform_device *pdev)
>  	if (!priv)
>  		return -ENOMEM;
>  
> +	if (mem_res->start & 0xFFFF)
> +		return -EINVAL;
> +

This check seems correct to me. But would it make sense to place it before
the call to devm_kzalloc() rather than after it? I think that should group
it would an existing checking of mem_res.

>  	priv->mem_res = *mem_res;
>  	/*
>  	 * The controller does not support/use port I/O,
> -- 
> 2.1.3
> 

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

* Re: [PATCH] PCI: rcar: Add address check of mem_res
  2015-02-13 16:44 ` Simon Horman
@ 2015-02-16  1:53   ` Nobuhiro Iwamatsu
  0 siblings, 0 replies; 3+ messages in thread
From: Nobuhiro Iwamatsu @ 2015-02-16  1:53 UTC (permalink / raw)
  To: Simon Horman; +Cc: bhelgaas, valentine.barshak, linux-pci

Hi,

Thnaks for your review.

(2015/02/14 1:44), Simon Horman wrote:
> Hi Iwamatsu-san,
>
> On Fri, Feb 13, 2015 at 04:55:38PM +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>
>> ---
>>   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..13b2793 100644
>> --- a/drivers/pci/host/pci-rcar-gen2.c
>> +++ b/drivers/pci/host/pci-rcar-gen2.c
>> @@ -351,6 +351,9 @@ static int rcar_pci_probe(struct platform_device *pdev)
>>   	if (!priv)
>>   		return -ENOMEM;
>>
>> +	if (mem_res->start&  0xFFFF)
>> +		return -EINVAL;
>> +
>
> This check seems correct to me. But would it make sense to place it before
> the call to devm_kzalloc() rather than after it? I think that should group
> it would an existing checking of mem_res.
>

Yes, I will resend patch.

>>   	priv->mem_res = *mem_res;
>>   	/*
>>   	 * The controller does not support/use port I/O,
>> --
>> 2.1.3
>>

Best regards,
   Nobuhiro

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

end of thread, other threads:[~2015-02-16  1:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-13  7:55 [PATCH] PCI: rcar: Add address check of mem_res Nobuhiro Iwamatsu
2015-02-13 16:44 ` Simon Horman
2015-02-16  1:53   ` Nobuhiro Iwamatsu

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).