Re: [patch 1/2] pinctrl: tegra-xusb: fix an off by one test

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

 



On Thu, Jul 31, 2014 at 06:22:17PM +0300, Dan Carpenter wrote:
> This shoudld be ">= ARRAY_SIZE()" instead of "> ARRAY_SIZE()".
> 
> Fixes: dc0a39386687 ('pinctrl: Add NVIDIA Tegra XUSB pad controller support')
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> 
> diff --git a/drivers/pinctrl/pinctrl-tegra-xusb.c b/drivers/pinctrl/pinctrl-tegra-xusb.c
> index a066204..419a047 100644
> --- a/drivers/pinctrl/pinctrl-tegra-xusb.c
> +++ b/drivers/pinctrl/pinctrl-tegra-xusb.c
> @@ -680,7 +680,7 @@ static struct phy *tegra_xusb_padctl_xlate(struct device *dev,
>  	if (args->args_count <= 0)
>  		return ERR_PTR(-EINVAL);
>  
> -	if (index > ARRAY_SIZE(padctl->phys))
> +	if (index >= ARRAY_SIZE(padctl->phys))
>  		return ERR_PTR(-EINVAL);
>  
>  	return padctl->phys[index];

Good catch!

Acked-by: Thierry Reding <treding@xxxxxxxxxx>

Attachment: pgpm92TCvkVW8.pgp
Description: PGP signature


[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux