Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Flora Cui and committed by
Alex Deucher
898c7302 0c701415

+1 -1
+1 -1
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
··· 604 604 int i = 0; 605 605 606 606 hdcp_work = kcalloc(max_caps, sizeof(*hdcp_work), GFP_KERNEL); 607 - if (hdcp_work == NULL) 607 + if (ZERO_OR_NULL_PTR(hdcp_work)) 608 608 return NULL; 609 609 610 610 hdcp_work->srm = kcalloc(PSP_HDCP_SRM_FIRST_GEN_MAX_SIZE, sizeof(*hdcp_work->srm), GFP_KERNEL);