]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amd/display: fix return value check for hdcp_work
authorFlora Cui <flora.cui@amd.com>
Wed, 23 Sep 2020 06:42:59 +0000 (14:42 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 29 Sep 2020 21:07:34 +0000 (17:07 -0400)
max_caps might be 0, thus hdcp_work might be ZERO_SIZE_PTR

Signed-off-by: Flora Cui <flora.cui@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c

index 694c5bc93665b6378b90f2a8f597cb76a753873a..c2cd184f0bbd4b9f3baacda407a64e0bd22a87e7 100644 (file)
@@ -604,7 +604,7 @@ struct hdcp_workqueue *hdcp_create_workqueue(struct amdgpu_device *adev, struct
        int i = 0;
 
        hdcp_work = kcalloc(max_caps, sizeof(*hdcp_work), GFP_KERNEL);
-       if (hdcp_work == NULL)
+       if (ZERO_OR_NULL_PTR(hdcp_work))
                return NULL;
 
        hdcp_work->srm = kcalloc(PSP_HDCP_SRM_FIRST_GEN_MAX_SIZE, sizeof(*hdcp_work->srm), GFP_KERNEL);