drm/amdgpu: fix integer overflow test in amdgpu_bo_list_create()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 10 Aug 2018 10:50:32 +0000 (18:50 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 Nov 2018 08:19:12 +0000 (09:19 +0100)
commit6fc72c1b886525ee5b6cb244fd2ee5d86fee070b
tree1b2610014728ea341756c95111d25cbae16e7e5a
parent36c99a16366115cb339148ff8f6d45383d85e080
drm/amdgpu: fix integer overflow test in amdgpu_bo_list_create()

[ Upstream commit ff30e9e8509cb877dc7cbc776b36c70f5bdd290f ]

We accidentally left out the size of the amdgpu_bo_list struct.  It
could lead to memory corruption on 32 bit systems.  You'd have to
pick the absolute maximum and set "num_entries == 59652323" then size
would wrap to 16 bytes.

Fixes: 920990cb080a ("drm/amdgpu: allocate the bo_list array after the list")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Bas Nieuwenhuizen <basni@chromium.org>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c