[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADnq5_M+H64ajv-Ri49j0GHgGKyhSQ-ZgyM31KukWXXLuwoknw@mail.gmail.com>
Date: Mon, 20 Jun 2016 17:11:19 -0400
From: Alex Deucher <alexdeucher@...il.com>
To: Nicolas Iooss <nicolas.iooss_linux@....org>
Cc: Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>,
Maling list - DRI developers
<dri-devel@...ts.freedesktop.org>,
LKML <linux-kernel@...r.kernel.org>,
"for 3.8" <stable@...r.kernel.org>
Subject: Re: [PATCH 1/1] drm/amdgpu: initialize amdgpu_cgs_acpi_eval_object
result value
On Sat, Jun 18, 2016 at 4:55 PM, Nicolas Iooss
<nicolas.iooss_linux@....org> wrote:
> amdgpu_cgs_acpi_eval_object() returned the value of variable "result"
> without initializing it first.
>
> This bug has been found by compiling the kernel with clang. The
> compiler complained:
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c:972:14: error: variable
> 'result' is used uninitialized whenever 'for' loop exits because its
> condition is false [-Werror,-Wsometimes-uninitialized]
> for (i = 0; i < count; i++) {
> ^~~~~~~~~
> drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c:1011:9: note: uninitialized
> use occurs here
> return result;
> ^~~~~~
> drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c:972:14: note: remove the
> condition if it is always true
> for (i = 0; i < count; i++) {
> ^~~~~~~~~
> drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c:864:12: note: initialize the
> variable 'result' to silence this warning
> int result;
> ^
> = 0
>
> Fixes: 3f1d35a03b3c ("drm/amdgpu: implement new cgs interface for acpi
> function")
> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@....org>
> Cc: stable@...r.kernel.org
Applied. thanks!
Alex
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
> index 8943099eb135..cf6f49fc1c75 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
> @@ -909,7 +909,7 @@ static int amdgpu_cgs_acpi_eval_object(struct cgs_device *cgs_device,
> struct cgs_acpi_method_argument *argument = NULL;
> uint32_t i, count;
> acpi_status status;
> - int result;
> + int result = 0;
> uint32_t func_no = 0xFFFFFFFF;
>
> handle = ACPI_HANDLE(&adev->pdev->dev);
> --
> 2.8.3
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@...ts.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Powered by blists - more mailing lists