From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Imre Deak <imre.deak@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/4] drm/i915/gen9: Avoid using negative array index in skl_update_plane()
Date: Thu, 12 May 2016 16:22:48 +0300 [thread overview]
Message-ID: <20160512132248.GN4329@intel.com> (raw)
In-Reply-To: <1463059132-1720-2-git-send-email-imre.deak@intel.com>
On Thu, May 12, 2016 at 04:18:49PM +0300, Imre Deak wrote:
> scaler_id may be negative as shown by conditions later in the function,
> so don't use it as an array index in that case.
>
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
> drivers/gpu/drm/i915/intel_sprite.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index 0f3e230..286bcc6 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -203,8 +203,6 @@ skl_update_plane(struct drm_plane *drm_plane,
> uint32_t y = plane_state->src.y1 >> 16;
> uint32_t src_w = drm_rect_width(&plane_state->src) >> 16;
> uint32_t src_h = drm_rect_height(&plane_state->src) >> 16;
> - const struct intel_scaler *scaler =
> - &crtc_state->scaler_state.scalers[plane_state->scaler_id];
>
> plane_ctl = PLANE_CTL_ENABLE |
> PLANE_CTL_PIPE_GAMMA_ENABLE |
> @@ -262,10 +260,14 @@ skl_update_plane(struct drm_plane *drm_plane,
> if (plane_state->scaler_id >= 0) {
> uint32_t ps_ctrl = 0;
> int scaler_id = plane_state->scaler_id;
> + const struct intel_scaler *scaler;
>
> DRM_DEBUG_KMS("plane = %d PS_PLANE_SEL(plane) = 0x%x\n", plane,
> PS_PLANE_SEL(plane));
> +
> + scaler = &crtc_state->scaler_state.scalers[scaler_id];
> ps_ctrl = PS_SCALER_EN | PS_PLANE_SEL(plane) | scaler->mode;
Could nuke ps_ctrl while at it perhaps.
But in any case
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> +
> I915_WRITE(SKL_PS_CTRL(pipe, scaler_id), ps_ctrl);
> I915_WRITE(SKL_PS_PWR_GATE(pipe, scaler_id), 0);
> I915_WRITE(SKL_PS_WIN_POS(pipe, scaler_id), (crtc_x << 16) | crtc_y);
> --
> 2.5.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-05-12 13:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-12 13:18 [PATCH 0/4] drm/i915: Fix a few code checker errors Imre Deak
2016-05-12 13:18 ` [PATCH 1/4] drm/i915/gen9: Avoid using negative array index in skl_update_plane() Imre Deak
2016-05-12 13:22 ` Ville Syrjälä [this message]
2016-05-12 13:18 ` [PATCH 2/4] drm/i915: Add comments about fixed pipe->transcoder/PLL mapping Imre Deak
2016-05-12 13:30 ` Ville Syrjälä
2016-05-12 14:00 ` Imre Deak
2016-05-12 14:53 ` Ville Syrjälä
2016-05-12 13:18 ` [PATCH 3/4] drm/i915: Handle error return from dma_set_coherent_mask() Imre Deak
2016-05-12 13:56 ` Ville Syrjälä
2016-05-12 13:18 ` [PATCH 4/4] drm/i915: Remove redundant const from function return type Imre Deak
2016-05-12 13:31 ` Ville Syrjälä
2016-05-12 15:31 ` ✗ Ro.CI.BAT: failure for drm/i915: Fix a few code checker errors Patchwork
2016-05-13 12:24 ` Imre Deak
2016-05-13 13:07 ` Chris Wilson
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=20160512132248.GN4329@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.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