[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADnq5_ODJOk3vV1QBQRQkMxZTa5reBqsPy-Q+1rrEBw4dJEtoQ@mail.gmail.com>
Date: Mon, 18 Nov 2019 12:47:49 -0500
From: Alex Deucher <alexdeucher@...il.com>
To: "Quan, Evan" <Evan.Quan@....com>
Cc: Colin King <colin.king@...onical.com>, Rex Zhu <rex.zhu@....com>,
"Deucher, Alexander" <Alexander.Deucher@....com>,
"Koenig, Christian" <Christian.Koenig@....com>,
"Zhou, David(ChunMing)" <David1.Zhou@....com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
"amd-gfx@...ts.freedesktop.org" <amd-gfx@...ts.freedesktop.org>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH][next] drm/amdgpu/powerplay: fix dereference before null
check of pointer hwmgr
Applied. Thanks!
Alex
On Mon, Nov 18, 2019 at 1:56 AM Quan, Evan <Evan.Quan@....com> wrote:
>
> Reviewed-by: Evan Quan <evan.quan@....com>
>
> -----Original Message-----
> From: Colin King <colin.king@...onical.com>
> Sent: Friday, November 15, 2019 5:48 PM
> To: Rex Zhu <rex.zhu@....com>; Quan, Evan <Evan.Quan@....com>; Deucher, Alexander <Alexander.Deucher@....com>; Koenig, Christian <Christian.Koenig@....com>; Zhou, David(ChunMing) <David1.Zhou@....com>; David Airlie <airlied@...ux.ie>; Daniel Vetter <daniel@...ll.ch>; amd-gfx@...ts.freedesktop.org; dri-devel@...ts.freedesktop.org
> Cc: kernel-janitors@...r.kernel.org; linux-kernel@...r.kernel.org
> Subject: [PATCH][next] drm/amdgpu/powerplay: fix dereference before null check of pointer hwmgr
>
> From: Colin Ian King <colin.king@...onical.com>
>
> The assignment of adev dereferences pointer hwmgr before hwmgr is null checked, hence there is a potential null pointer deference issue. Fix this by assigning adev after the null check.
>
> Addresses-Coverity: ("Dereference before null check")
> Fixes: 0896d2f7ba4d ("drm/amdgpu/powerplay: properly set PP_GFXOFF_MASK")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
> drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
> index 443625c83ec9..d2909c91d65b 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
> @@ -81,7 +81,7 @@ static void hwmgr_init_workload_prority(struct pp_hwmgr *hwmgr)
>
> int hwmgr_early_init(struct pp_hwmgr *hwmgr) {
> - struct amdgpu_device *adev = hwmgr->adev;
> + struct amdgpu_device *adev;
>
> if (!hwmgr)
> return -EINVAL;
> @@ -96,6 +96,8 @@ int hwmgr_early_init(struct pp_hwmgr *hwmgr)
> hwmgr_init_workload_prority(hwmgr);
> hwmgr->gfxoff_state_changed_by_workload = false;
>
> + adev = hwmgr->adev;
> +
> switch (hwmgr->chip_family) {
> case AMDGPU_FAMILY_CI:
> adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
> --
> 2.20.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@...ts.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Powered by blists - more mailing lists