summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/drm/amd/amdgpu/amdgpu_pm.c
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2020-08-05 10:58:41 +0000
committerjsg <jsg@openbsd.org>2020-08-05 10:58:41 +0000
commite1afeb4cef2192a8f98edc44d74b95a03aef4694 (patch)
tree9100891569efb0741d1e3a60a111622a35dc34a2 /sys/dev/pci/drm/amd/amdgpu/amdgpu_pm.c
parentChange searching to behave more like emacs and so that regex searching (diff)
downloadwireguard-openbsd-e1afeb4cef2192a8f98edc44d74b95a03aef4694.tar.xz
wireguard-openbsd-e1afeb4cef2192a8f98edc44d74b95a03aef4694.zip
Revert "drm/amdgpu: Fix NULL dereference in dpm sysfs handlers"
From Alex Deucher f53aaf88742ccee0e9aa4ed7d700ceeb434d9a7a in linux 5.7.y/5.7.13 87004abfbc27261edd15716515d89ab42198b405 in mainline linux
Diffstat (limited to 'sys/dev/pci/drm/amd/amdgpu/amdgpu_pm.c')
-rw-r--r--sys/dev/pci/drm/amd/amdgpu/amdgpu_pm.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_pm.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_pm.c
index efe335ec8c7..044ee6991b5 100644
--- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_pm.c
+++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_pm.c
@@ -777,7 +777,8 @@ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev,
tmp_str++;
while (isspace(*++tmp_str));
- while ((sub_str = strsep(&tmp_str, delimiter)) != NULL) {
+ while (tmp_str[0]) {
+ sub_str = strsep(&tmp_str, delimiter);
ret = kstrtol(sub_str, 0, &parameter[parameter_size]);
if (ret)
return -EINVAL;
@@ -1037,7 +1038,8 @@ static ssize_t amdgpu_read_mask(const char *buf, size_t count, uint32_t *mask)
memcpy(buf_cpy, buf, bytes);
buf_cpy[bytes] = '\0';
tmp = buf_cpy;
- while ((sub_str = strsep(&tmp, delimiter)) != NULL) {
+ while (tmp[0]) {
+ sub_str = strsep(&tmp, delimiter);
if (strlen(sub_str)) {
ret = kstrtol(sub_str, 0, &level);
if (ret)
@@ -1634,7 +1636,8 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev,
i++;
memcpy(buf_cpy, buf, count-i);
tmp_str = buf_cpy;
- while ((sub_str = strsep(&tmp_str, delimiter)) != NULL) {
+ while (tmp_str[0]) {
+ sub_str = strsep(&tmp_str, delimiter);
ret = kstrtol(sub_str, 0, &parameter[parameter_size]);
if (ret)
return -EINVAL;