mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-28 11:08:09 -04:00
drm/i915/dmc: check incoming dmc id validity
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> Reviewed-by: Imre Deak <imre.deak@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/6a349c3a2b2def5fc31a48c9844ebd72ee55a22b.1675339447.git.jani.nikula@intel.com
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user