From: Axel Lin Date: Fri, 27 Feb 2015 15:44:24 +0000 (+0800) Subject: phy: exynos5-usbdrd: Fix off-by-one valid value checking for args->args[0] X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=ecd5fb026d460bf8fb883254fb9bd01a1085c185;p=openwrt%2Fstaging%2Fblogic.git phy: exynos5-usbdrd: Fix off-by-one valid value checking for args->args[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 Reviewed by: Vivek Gautam Signed-off-by: Kishon Vijay Abraham I --- diff --git a/drivers/phy/phy-exynos5-usbdrd.c b/drivers/phy/phy-exynos5-usbdrd.c index 04374018425f..e2a0be750ad9 100644 --- a/drivers/phy/phy-exynos5-usbdrd.c +++ b/drivers/phy/phy-exynos5-usbdrd.c @@ -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;