diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2020-08-09 22:34:06 +0200 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2020-08-10 17:19:12 -0400 |
commit | 5068ed578e34450a285fca3f9d830361b44267ad (patch) | |
tree | 03ab87907761feb27f83f1d79dd579bfcb487888 /drivers/gpu | |
parent | 82c2454761298a2fdaade6a253a7b034b9cfa15d (diff) | |
download | linux-stable-5068ed578e34450a285fca3f9d830361b44267ad.tar.gz linux-stable-5068ed578e34450a285fca3f9d830361b44267ad.tar.bz2 linux-stable-5068ed578e34450a285fca3f9d830361b44267ad.zip |
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: f44ffd677fb3 ("drm/amdgpu: add support for exporting VRAM using DMA-buf v3")
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c index 97ad8ffe6c6c..be6a7ec22de4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c @@ -463,7 +463,7 @@ int amdgpu_vram_mgr_alloc_sgt(struct amdgpu_device *adev, unsigned int pages; int i, r; - *sgt = kmalloc(sizeof(*sg), GFP_KERNEL); + *sgt = kmalloc(sizeof(**sgt), GFP_KERNEL); if (!*sgt) return -ENOMEM; |