From: Christian König Date: Fri, 14 Sep 2018 19:03:37 +0000 (+0200) Subject: drm/amdgpu: don't allocate zero sized kernel BOs X-Git-Tag: Ubuntu-5.2.0-15.16~3278^2~24^2~20 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=21a7e77f77b348e73c9c67064a545e724c4a0c9a;p=mirror_ubuntu-eoan-kernel.git drm/amdgpu: don't allocate zero sized kernel BOs Just free the BO if the size should be zero. Signed-off-by: Christian König Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index e6909252aefa..84d82d5382f9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -250,6 +250,11 @@ int amdgpu_bo_create_reserved(struct amdgpu_device *adev, bool free = false; int r; + if (!size) { + amdgpu_bo_unref(bo_ptr); + return 0; + } + memset(&bp, 0, sizeof(bp)); bp.size = size; bp.byte_align = align;