Skip to content

Commit 78484d7

Browse files
tititiou36alexdeucher
authored andcommitted
drm: amdgpu: Use the correct size when allocating memory
When '*sgt' is allocated, we must allocated 'sizeof(**sgt)' bytes instead of 'sizeof(*sg)'. The sizeof(*sg) is bigger than sizeof(**sgt) so this wastes memory but it won't lead to corruption. Fixes: f44ffd6 ("drm/amdgpu: add support for exporting VRAM using DMA-buf v3") Reviewed-by: Christian König <[email protected]> Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected]
1 parent f878122 commit 78484d7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ int amdgpu_vram_mgr_alloc_sgt(struct amdgpu_device *adev,
462462
unsigned int pages;
463463
int i, r;
464464

465-
*sgt = kmalloc(sizeof(*sg), GFP_KERNEL);
465+
*sgt = kmalloc(sizeof(**sgt), GFP_KERNEL);
466466
if (!*sgt)
467467
return -ENOMEM;
468468

0 commit comments

Comments
 (0)