drm: amdgpu: Use the correct size when allocating memory
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 9 Aug 2020 20:34:06 +0000 (22:34 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Aug 2020 09:49:02 +0000 (11:49 +0200)
commitbdc689905befb91a81fcaae29ac70e2203704012
tree511596391f266394b04cadeda76f2893e1d6e69a
parent144fa0580fbe72a611e5106e75941436946048fc
drm: amdgpu: Use the correct size when allocating memory

commit 78484d7c747e30468b35bd5f19edf602f50162a7 upstream.

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>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c