|
@@ -31,7 +31,7 @@
|
|
#include <linux/power_supply.h>
|
|
#include <linux/power_supply.h>
|
|
#include <linux/hwmon.h>
|
|
#include <linux/hwmon.h>
|
|
#include <linux/hwmon-sysfs.h>
|
|
#include <linux/hwmon-sysfs.h>
|
|
-
|
|
|
|
|
|
+#include <linux/nospec.h>
|
|
|
|
|
|
static int amdgpu_debugfs_pm_init(struct amdgpu_device *adev);
|
|
static int amdgpu_debugfs_pm_init(struct amdgpu_device *adev);
|
|
|
|
|
|
@@ -403,6 +403,7 @@ static ssize_t amdgpu_set_pp_force_state(struct device *dev,
|
|
count = -EINVAL;
|
|
count = -EINVAL;
|
|
goto fail;
|
|
goto fail;
|
|
}
|
|
}
|
|
|
|
+ idx = array_index_nospec(idx, ARRAY_SIZE(data.states));
|
|
|
|
|
|
amdgpu_dpm_get_pp_num_states(adev, &data);
|
|
amdgpu_dpm_get_pp_num_states(adev, &data);
|
|
state = data.states[idx];
|
|
state = data.states[idx];
|