Skip to content

Commit 420c81c

Browse files
Dan Carpenteralexdeucher
authored andcommitted
drm/amdgpu: check for allocation failure in amdgpu_vkms_sw_init()
Check whether the kcalloc() fails and return -ENOMEM if it does. Fixes: 84ec374 ("drm/amdgpu: create amdgpu_vkms (v4)") Reviewed-by: Christian König <[email protected]> Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 1b41d67 commit 420c81c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,8 @@ static int amdgpu_vkms_sw_init(void *handle)
482482
return r;
483483

484484
adev->amdgpu_vkms_output = kcalloc(adev->mode_info.num_crtc, sizeof(struct amdgpu_vkms_output), GFP_KERNEL);
485+
if (!adev->amdgpu_vkms_output)
486+
return -ENOMEM;
485487

486488
/* allocate crtcs, encoders, connectors */
487489
for (i = 0; i < adev->mode_info.num_crtc; i++) {

0 commit comments

Comments
 (0)