[PATCH] drm/amd/display: fix return value check for hdcp_work

Xu, Feifei Feifei.Xu at amd.com
Wed Sep 23 07:03:14 UTC 2020


[AMD Official Use Only - Internal Distribution Only]

Reviewed-by: Feifei Xu <Feifei.Xu at amd.com>

-----Original Message-----
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Flora Cui
Sent: Wednesday, September 23, 2020 2:54 PM
To: amd-gfx at lists.freedesktop.org
Cc: Cui, Flora <Flora.Cui at amd.com>
Subject: [PATCH] drm/amd/display: fix return value check for hdcp_work

max_caps might be 0, thus hdcp_work might be ZERO_SIZE_PTR

Signed-off-by: Flora Cui <flora.cui at amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
index 694c5bc93665..c2cd184f0bbd 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
@@ -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);
--
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx at lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CFeifei.Xu%40amd.com%7Ca62e4acb342a497ae9b708d85f8d8188%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637364408659753568&sdata=Nd%2FAYwpHlCtA9OH1jwwIo8FySKOMVUQD7GyuIsER%2F4g%3D&reserved=0


More information about the amd-gfx mailing list