OSDN Git Service

drm/amdkfd: fix a dereference of pdd before it is null checked
authorColin Ian King <colin.king@canonical.com>
Thu, 28 May 2020 22:24:53 +0000 (23:24 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 29 May 2020 17:54:38 +0000 (13:54 -0400)
Currently pointer pdd is being dereferenced when assigning pointer
dpm and then pdd is being null checked.  Fix this by checking if
pdd is null before the dereference of pdd occurs.

Addresses-Coverity: ("Dereference before null check")
Fixes: 32cb59f31362 ("drm/amdkfd: Track SDMA utilization per process")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_process.c

index db010c5..a9a7f5a 100644 (file)
@@ -103,10 +103,11 @@ static void kfd_sdma_activity_worker(struct work_struct *work)
                return;
 
        pdd = workarea->pdd;
+       if (!pdd)
+               return;
        dqm = pdd->dev->dqm;
        qpd = &pdd->qpd;
-
-       if (!pdd || !dqm || !qpd)
+       if (!dqm || !qpd)
                return;
 
        mm = get_task_mm(pdd->process->lead_thread);