Skip to content

Commit

Permalink
phy: exynos5-usbdrd: Fix off-by-one valid value checking for args->ar…
Browse files Browse the repository at this point in the history
…gs[0]

Current code uses args->args[0] as array subscript of phy_drd->phys[].
So the valid value range for args->args[0] is 0 ... EXYNOS5_DRDPHYS_NUM - 1.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed by: Vivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
  • Loading branch information
AxelLin authored and kishon committed Mar 13, 2015
1 parent 2f1bce4 commit ecd5fb0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/phy/phy-exynos5-usbdrd.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ static struct phy *exynos5_usbdrd_phy_xlate(struct device *dev,
{
struct exynos5_usbdrd_phy *phy_drd = dev_get_drvdata(dev);

if (WARN_ON(args->args[0] > EXYNOS5_DRDPHYS_NUM))
if (WARN_ON(args->args[0] >= EXYNOS5_DRDPHYS_NUM))
return ERR_PTR(-ENODEV);

return phy_drd->phys[args->args[0]].phy;
Expand Down

0 comments on commit ecd5fb0

Please sign in to comment.