Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 5/5] drm/i915/dmc: check incoming dmc id validity
Date: Thu, 2 Feb 2023 17:13:44 +0200	[thread overview]
Message-ID: <Y9vTKDHR9Ojd7Yn9@ideak-desk.fi.intel.com> (raw)
In-Reply-To: <6a349c3a2b2def5fc31a48c9844ebd72ee55a22b.1675339447.git.jani.nikula@intel.com>

On Thu, Feb 02, 2023 at 02:04:52PM +0200, Jani Nikula wrote:
> Add validity checks for the dmc ids computed from pipe parameters in
> intel_dmc_enable_pipe() and intel_dmc_disable_pipe(). It's slightly
> difficult for humans and static analyzers alike to ensure the resulting
> dmc ids are within bounds. Just check them and reject invalid ones.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Patchset looks ok to me:
Reviewed-by: Imre Deak <imre.deak@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_dmc.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dmc.c b/drivers/gpu/drm/i915/display/intel_dmc.c
> index ab0ad8e3e620..3b8e8193d042 100644
> --- a/drivers/gpu/drm/i915/display/intel_dmc.c
> +++ b/drivers/gpu/drm/i915/display/intel_dmc.c
> @@ -415,7 +415,9 @@ static void pipedmc_clock_gating_wa(struct drm_i915_private *i915, bool enable)
>  
>  void intel_dmc_enable_pipe(struct drm_i915_private *i915, enum pipe pipe)
>  {
> -	if (!has_dmc_id_fw(i915, PIPE_TO_DMC_ID(pipe)))
> +	enum intel_dmc_id dmc_id = PIPE_TO_DMC_ID(pipe);
> +
> +	if (!is_valid_dmc_id(dmc_id) || !has_dmc_id_fw(i915, dmc_id))
>  		return;
>  
>  	if (DISPLAY_VER(i915) >= 14)
> @@ -426,7 +428,9 @@ void intel_dmc_enable_pipe(struct drm_i915_private *i915, enum pipe pipe)
>  
>  void intel_dmc_disable_pipe(struct drm_i915_private *i915, enum pipe pipe)
>  {
> -	if (!has_dmc_id_fw(i915, PIPE_TO_DMC_ID(pipe)))
> +	enum intel_dmc_id dmc_id = PIPE_TO_DMC_ID(pipe);
> +
> +	if (!is_valid_dmc_id(dmc_id) || !has_dmc_id_fw(i915, dmc_id))
>  		return;
>  
>  	if (DISPLAY_VER(i915) >= 14)
> -- 
> 2.34.1
> 

  reply	other threads:[~2023-02-02 15:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-02 12:04 [Intel-gfx] [PATCH 0/5] drm/i915/dmc: some dmc id related fixes and cleanups Jani Nikula
2023-02-02 12:04 ` [Intel-gfx] [PATCH 1/5] drm/i915/dmc: add proper name to dmc id enum and use it Jani Nikula
2023-02-02 12:04 ` [Intel-gfx] [PATCH 2/5] drm/i915/dmc: add for_each_dmc_id() " Jani Nikula
2023-02-02 12:04 ` [Intel-gfx] [PATCH 3/5] drm/i915/dmc: remove unnecessary dmc_id validity check Jani Nikula
2023-02-02 12:04 ` [Intel-gfx] [PATCH 4/5] drm/i915/dmc: add is_valid_dmc_id() and use it Jani Nikula
2023-02-02 12:04 ` [Intel-gfx] [PATCH 5/5] drm/i915/dmc: check incoming dmc id validity Jani Nikula
2023-02-02 15:13   ` Imre Deak [this message]
2023-02-03 10:34     ` Jani Nikula
2023-02-02 14:05 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/dmc: some dmc id related fixes and cleanups Patchwork
2023-02-02 14:29 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-02-02 18:05 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

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=Y9vTKDHR9Ojd7Yn9@ideak-desk.fi.intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    /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