[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Zs3Gm4KIIN6EMNYP@duo.ucw.cz>
Date: Tue, 27 Aug 2024 14:29:15 +0200
From: Pavel Machek <pavel@...x.de>
To: Sasha Levin <sashal@...nel.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Jesse Zhang <jesse.zhang@....com>, Tim Huang <Tim.Huang@....com>,
Alex Deucher <alexander.deucher@....com>, kenneth.feng@....com,
christian.koenig@....com, Xinhui.Pan@....com, airlied@...il.com,
daniel@...ll.ch, Jun.Ma2@....com, mario.limonciello@....com,
yifan1.zhang@....com, lijo.lazar@....com,
amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH AUTOSEL 6.1 05/61] drm/amd/pm: Fix negative array index
read
Hi!
> From: Jesse Zhang <jesse.zhang@....com>
>
> [ 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
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists