From: Mika Kahola <mika.kahola@intel.com>
To: Jani Nikula <jani.nikula@intel.com>, intel-gfx@lists.freedesktop.org
Cc: "# v4 . 10+" <stable@vger.kernel.org>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
Jani Nikula <jani.nikula@linux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Subject: Re: [PATCH] drm/i915/audio: fix check for av_enc_map overflow
Date: Thu, 15 Feb 2018 09:42:32 +0200 [thread overview]
Message-ID: <1518680552.7484.16.camel@intel.com> (raw)
In-Reply-To: <20180214173840.25360-1-jani.nikula@intel.com>
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: <stable@vger.kernel.org> # v4.10+
> Cc: Mika Kahola <mika.kahola@intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: intel-gfx@lists.freedesktop.org
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@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
--
Mika Kahola - Intel OTC
next prev parent reply other threads:[~2018-02-15 7:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-14 17:38 [PATCH] drm/i915/audio: fix check for av_enc_map overflow Jani Nikula
2018-02-14 20:07 ` [Intel-gfx] " Pandiyan, Dhinakaran
2018-02-15 7:42 ` Mika Kahola [this message]
2018-02-15 15:03 ` Jani Nikula
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1518680552.7484.16.camel@intel.com \
--to=mika.kahola@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox