From: "Pandiyan, Dhinakaran" <dhinakaran.pandiyan@intel.com>
To: "Nikula, Jani" <jani.nikula@intel.com>
Cc: "intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
"Vivi, Rodrigo" <rodrigo.vivi@intel.com>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [Intel-gfx] [PATCH] drm/i915/audio: fix check for av_enc_map overflow
Date: Wed, 14 Feb 2018 20:07:07 +0000 [thread overview]
Message-ID: <1518640221.2572.120.camel@dk-H97M-D3H> (raw)
In-Reply-To: <20180214173840.25360-1-jani.nikula@intel.com>
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: <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
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@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
next prev parent reply other threads:[~2018-02-14 20:07 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 ` Pandiyan, Dhinakaran [this message]
2018-02-15 7:42 ` Mika Kahola
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=1518640221.2572.120.camel@dk-H97M-D3H \
--to=dhinakaran.pandiyan@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@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