From: Antoine Ténart Date: Mon, 12 May 2014 12:56:28 +0000 (+0200) Subject: phy: exynos-mipi-video: fix check on array index X-Git-Tag: submit/tizen_common/20140730.172411~423 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e248558984dc61187b315fc493ad397bbb4c15cb;p=profile%2Fivi%2Fkernel-x86-ivi.git phy: exynos-mipi-video: fix check on array index commit 98c3b32229f2685c13436b652b8959c99dfc5a31 upstream. The phys array is of size EXYNOS_MIPI_PHYS_NUM. Trying to access the index EXYNOS_MIPI_PHYS_NUM should return an error. Fixes: 069d2e26e9d6 "phy: Add driver for Exynos MIPI CSIS/DSIM DPHYs" Signed-off-by: Antoine Ténart Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c index 7f13932..ff02668 100644 --- a/drivers/phy/phy-exynos-mipi-video.c +++ b/drivers/phy/phy-exynos-mipi-video.c @@ -101,7 +101,7 @@ static struct phy *exynos_mipi_video_phy_xlate(struct device *dev, { struct exynos_mipi_video_phy *state = dev_get_drvdata(dev); - if (WARN_ON(args->args[0] > EXYNOS_MIPI_PHYS_NUM)) + if (WARN_ON(args->args[0] >= EXYNOS_MIPI_PHYS_NUM)) return ERR_PTR(-ENODEV); return state->phys[args->args[0]].phy;