Re: [PATCH 5/5] drm/i915/dmc: check incoming dmc id validity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 02 Feb 2023, Imre Deak <imre.deak@xxxxxxxxx> wrote:
> 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@xxxxxxxxx>
>
> Patchset looks ok to me:
> Reviewed-by: Imre Deak <imre.deak@xxxxxxxxx>

Thanks for the review, pushed to din.

BR,
Jani

>
>> ---
>>  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
>> 

-- 
Jani Nikula, Intel Open Source Graphics Center



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux