Skip to contentSkip to conversation

drm/amd/pm: correct string parsing for extra separator characters case

PATCH In review Evan Quan 2 participants 2 messages Jan 21, 2021 – Jan 22, 2021

Subsystems (3)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 1/1 drm/amd/pm: correct string parsing for extra separator characters case

Supplement of previous fix "2d873f24dfaf drm/amdgpu/pm: Account for extra separator characters in sysfs interface".

Change-Id Ie9e9a78ad8530ba4b46ea27e28559d5dcda5c033
---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2 -0
index ba1539f6e0ce..ac150e63dd25 100644
@@ -1866,6 +1866,8 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev,
 		memcpy(buf_cpy, buf, count-i);
 		tmp_str = buf_cpy;
 		while ((sub_str = strsep(&tmp_str, delimiter)) != NULL) {
+			if (strlen(sub_str) == 0)
+				continue;
 			ret = kstrtol(sub_str, 0, &parameter[parameter_size]);
 			if (ret)
 				return -EINVAL;
Signature · 6 lines
2.29.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Evan Quan

Supplement of previous fix "2d873f24dfaf drm/amdgpu/pm: Account for extra separator characters in sysfs interface".

Change-Id Ie9e9a78ad8530ba4b46ea27e28559d5dcda5c033
Quoted 20 lines
---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2 -1
index ba1539f6e0ce..ac150e63dd25 100644
@@ -1866,6 +1866,8 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev,
                memcpy(buf_cpy, buf, count-i);
                tmp_str = buf_cpy;
                while ((sub_str = strsep(&tmp_str, delimiter)) != NULL) {
+                       if (strlen(sub_str) == 0)
+                               continue;
                        ret = kstrtol(sub_str, 0, &parameter[parameter_size]);
                        if (ret)
                                return -EINVAL;
--

2.29.0

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx