Re: [PATCH AUTOSEL 6.1 05/61] drm/amd/pm: Fix negative array index read

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

 



Hi!

> From: Jesse Zhang <jesse.zhang@xxxxxxx>
> 
> [ Upstream commit c8c19ebf7c0b202a6a2d37a52ca112432723db5f ]
> 
> Avoid using the negative values
> for clk_idex as an index into an array pptable->DpmDescriptor.
> 
> V2: fix clk_index return check (Tim Huang)

>  	dpm_desc = &pptable->DpmDescriptor[clk_index];
>  
>  	/* 0 - Fine grained DPM, 1 - Discrete DPM */
> -	return dpm_desc->SnapToDiscrete == 0;
> +	return dpm_desc->SnapToDiscrete == 0 ? 1 : 0;
>  }
>

Original code was already returning 0/1, no need for this. You could
use !!() to emphatise that, but really....

> +		if (ret) {
>  			soft_max_level = (soft_max_level >= 1 ? 1 : 0);
>  			soft_min_level = (soft_min_level >= 1 ? 1 : 0);

Same here.

Best regards,
								Pavel

-- 
DENX Software Engineering GmbH,        Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Attachment: signature.asc
Description: PGP signature


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

  Powered by Linux