diff mbox

drm/exynos: fix checks for valid mixer window

Message ID 1369634443-16157-1-git-send-email-sw0312.kim@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Seung-Woo Kim May 27, 2013, 6 a.m. UTC
From: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Valid values for mixer window are from 0 to MIXER_WIN_NR-1 inclusive.
Arrays in structures (e.g. mixer_context.win_data) have size of
MIXER_WIN_NR so checks for wrong mixer window must be greater-equal.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Hyunhee Kim <hyunhee.kim@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_hdmi.c |    4 ++--
 drivers/gpu/drm/exynos/exynos_mixer.c    |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Inki Dae May 27, 2013, 6:18 a.m. UTC | #1
Applied.

Thanks,
Inki Dae


2013/5/27 Seung-Woo Kim <sw0312.kim@samsung.com>

> From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
>
> Valid values for mixer window are from 0 to MIXER_WIN_NR-1 inclusive.
> Arrays in structures (e.g. mixer_context.win_data) have size of
> MIXER_WIN_NR so checks for wrong mixer window must be greater-equal.
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Hyunhee Kim <hyunhee.kim@samsung.com>
> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_hdmi.c |    4 ++--
>  drivers/gpu/drm/exynos/exynos_mixer.c    |    2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
> b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
> index 437fb94..b9b2726 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
> @@ -344,7 +344,7 @@ static void drm_mixer_commit(struct device
> *subdrv_dev, int zpos)
>
>         DRM_DEBUG_KMS("%s\n", __FILE__);
>
> -       if (win < 0 || win > MIXER_WIN_NR) {
> +       if (win < 0 || win >= MIXER_WIN_NR) {
>                 DRM_ERROR("mixer window[%d] is wrong\n", win);
>                 return;
>         }
> @@ -362,7 +362,7 @@ static void drm_mixer_disable(struct device
> *subdrv_dev, int zpos)
>
>         DRM_DEBUG_KMS("%s\n", __FILE__);
>
> -       if (win < 0 || win > MIXER_WIN_NR) {
> +       if (win < 0 || win >= MIXER_WIN_NR) {
>                 DRM_ERROR("mixer window[%d] is wrong\n", win);
>                 return;
>         }
> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c
> b/drivers/gpu/drm/exynos/exynos_mixer.c
> index 7c197d38..3658e07 100644
> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
> @@ -742,7 +742,7 @@ static void mixer_win_mode_set(void *ctx,
>         if (win == DEFAULT_ZPOS)
>                 win = MIXER_DEFAULT_WIN;
>
> -       if (win < 0 || win > MIXER_WIN_NR) {
> +       if (win < 0 || win >= MIXER_WIN_NR) {
>                 DRM_ERROR("mixer window[%d] is wrong\n", win);
>                 return;
>         }
> --
> 1.7.4.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
index 437fb94..b9b2726 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
@@ -344,7 +344,7 @@  static void drm_mixer_commit(struct device *subdrv_dev, int zpos)
 
 	DRM_DEBUG_KMS("%s\n", __FILE__);
 
-	if (win < 0 || win > MIXER_WIN_NR) {
+	if (win < 0 || win >= MIXER_WIN_NR) {
 		DRM_ERROR("mixer window[%d] is wrong\n", win);
 		return;
 	}
@@ -362,7 +362,7 @@  static void drm_mixer_disable(struct device *subdrv_dev, int zpos)
 
 	DRM_DEBUG_KMS("%s\n", __FILE__);
 
-	if (win < 0 || win > MIXER_WIN_NR) {
+	if (win < 0 || win >= MIXER_WIN_NR) {
 		DRM_ERROR("mixer window[%d] is wrong\n", win);
 		return;
 	}
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index 7c197d38..3658e07 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -742,7 +742,7 @@  static void mixer_win_mode_set(void *ctx,
 	if (win == DEFAULT_ZPOS)
 		win = MIXER_DEFAULT_WIN;
 
-	if (win < 0 || win > MIXER_WIN_NR) {
+	if (win < 0 || win >= MIXER_WIN_NR) {
 		DRM_ERROR("mixer window[%d] is wrong\n", win);
 		return;
 	}