z

On Wed, 2018-02-14 at 19:38 +0200, Jani Nikula wrote:
> Turns out -1 >= ARRAY_SIZE() is always true. Move the bounds check where
> we know pipe >= 0 and next to the array indexing where it makes most
> sense.
> 
> Fixes: 9965db26ac05 ("drm/i915: Check for fused or unused pipes")
> Fixes: 0b7029b7e43f ("drm/i915: Check for fused or unused pipes")
> Cc: <sta...@vger.kernel.org> # v4.10+
> Cc: Mika Kahola <mika.kah...@intel.com>
> Cc: Rodrigo Vivi <rodrigo.v...@intel.com>
> Cc: Jani Nikula <jani.nik...@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahti...@linux.intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Signed-off-by: Jani Nikula <jani.nik...@intel.com>

Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandi...@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_audio.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_audio.c 
> b/drivers/gpu/drm/i915/intel_audio.c
> index ff455c724775..709d6ca68074 100644
> --- a/drivers/gpu/drm/i915/intel_audio.c
> +++ b/drivers/gpu/drm/i915/intel_audio.c
> @@ -779,11 +779,11 @@ static struct intel_encoder *get_saved_enc(struct 
> drm_i915_private *dev_priv,
>  {
>       struct intel_encoder *encoder;
>  
> -     if (WARN_ON(pipe >= ARRAY_SIZE(dev_priv->av_enc_map)))
> -             return NULL;
> -
>       /* MST */
>       if (pipe >= 0) {
> +             if (WARN_ON(pipe >= ARRAY_SIZE(dev_priv->av_enc_map)))
> +                     return NULL;
> +
>               encoder = dev_priv->av_enc_map[pipe];
>               /*
>                * when bootup, audio driver may not know it is
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to