Re: [PATCH] PCI: rcar: Add address check of mem_res

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

 



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@xxxxxxxxxxx>
> ---
>  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
> 
--
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