[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a836cafa-86a9-3d72-1f02-f9f2d58ee127@amd.com>
Date: Fri, 2 Jul 2021 18:51:27 -0400
From: Luben Tuikov <luben.tuikov@....com>
To: trix@...hat.com, alexander.deucher@....com,
christian.koenig@....com, Xinhui.Pan@....com, airlied@...ux.ie,
daniel@...ll.ch, Hawking.Zhang@....com, Dennis.Li@....com,
guchun.chen@....com, Stanley.Yang@....com, nirmoy.das@....com
Cc: amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org,
"Tuikov, Luben" <Luben.Tuikov@....com>
Subject: Re: [PATCH] drm/amdgpu: initialize amdgpu_ras_query_error_count()
error count parameters
That's a good find, but I'd rather functions have no side effects. I'll follow up with a patch which correctly fixes this.
Regards,
Luben
On 2021-07-02 3:52 p.m., trix@...hat.com wrote:
> From: Tom Rix <trix@...hat.com>
>
> Static analysis reports this problem
> amdgpu_ras.c:2324:2: warning: 2nd function call argument is an
> uninitialized value
> atomic_set(&con->ras_ce_count, ce_count);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> ce_count is normally set by the earlier call to
> amdgpu_ras_query_error_count(). But amdgpu_ras_query_error_count()
> can return early without setting, leaving its error count parameters
> in a garbage state.
>
> Initialize the error count parameters earlier.
>
> Fixes: a46751fbcde5 ("drm/amdgpu: Fix RAS function interface")
> Signed-off-by: Tom Rix <trix@...hat.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> index 875874ea745ec..c80fa545aa2b8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> @@ -1056,6 +1056,12 @@ void amdgpu_ras_query_error_count(struct amdgpu_device *adev,
> struct ras_manager *obj;
> unsigned long ce, ue;
>
> + if (ce_count)
> + *ce_count = 0;
> +
> + if (ue_count)
> + *ue_count = 0;
> +
> if (!adev->ras_enabled || !con)
> return;
>
Powered by blists - more mailing lists