]> git.baikalelectronics.ru Git - kernel.git/commit
drm/amdgpu: missing bounds check in amdgpu_set_pp_force_state()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 16 Jun 2016 08:30:23 +0000 (11:30 +0300)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 17 Jun 2016 17:50:10 +0000 (13:50 -0400)
commitee7f73697dd6d33d1ff2f0e56f702d79da417561
tree178d8d94fb6f673e9681eae1429fc0e5c65780ad
parente7ce490697d1fd4bd6cce279aa7062d59aa7a6c4
drm/amdgpu: missing bounds check in amdgpu_set_pp_force_state()

There is no limit on high "idx" can go.  It should be less than
ARRAY_SIZE(data.states) which is 16.

The "data" variable wasn't declared in that scope so I shifted the code
around a bit to make it work.  Also I made "idx" unsigned.

Fixes: 319f3b9d54f7 ('drm/amd/powerplay: add some sysfs interfaces for powerplay.')
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c