public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] phy: exynos5-usbdrd: Fix off-by-one valid value checking for args->args[0]
@ 2015-02-27 15:44 Axel Lin
  2015-03-02 11:11 ` Vivek Gautam
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2015-02-27 15:44 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Vivek Gautam, linux-kernel@vger.kernel.org,
	linux-samsung-soc@vger.kernel.org

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>
---
 drivers/phy/phy-exynos5-usbdrd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/phy-exynos5-usbdrd.c b/drivers/phy/phy-exynos5-usbdrd.c
index 0437401..e2a0be7 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;
-- 
1.9.1




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

end of thread, other threads:[~2015-03-02 11:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-27 15:44 [PATCH] phy: exynos5-usbdrd: Fix off-by-one valid value checking for args->args[0] Axel Lin
2015-03-02 11:11 ` Vivek Gautam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox