Skip to content

Commit ffdf9f8

Browse files
alexdeuchergregkh
authored andcommitted
Revert "drm/amdgpu: Fix NULL dereference in dpm sysfs handlers"
commit 2456c29 upstream. This regressed some working configurations so revert it. Will fix this properly for 5.9 and backport then. This reverts commit 38e0c89. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 061fe18 commit ffdf9f8

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,8 @@ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev,
796796
tmp_str++;
797797
while (isspace(*++tmp_str));
798798

799-
while ((sub_str = strsep(&tmp_str, delimiter)) != NULL) {
799+
while (tmp_str[0]) {
800+
sub_str = strsep(&tmp_str, delimiter);
800801
ret = kstrtol(sub_str, 0, &parameter[parameter_size]);
801802
if (ret)
802803
return -EINVAL;
@@ -1066,7 +1067,8 @@ static ssize_t amdgpu_read_mask(const char *buf, size_t count, uint32_t *mask)
10661067
memcpy(buf_cpy, buf, bytes);
10671068
buf_cpy[bytes] = '\0';
10681069
tmp = buf_cpy;
1069-
while ((sub_str = strsep(&tmp, delimiter)) != NULL) {
1070+
while (tmp[0]) {
1071+
sub_str = strsep(&tmp, delimiter);
10701072
if (strlen(sub_str)) {
10711073
ret = kstrtol(sub_str, 0, &level);
10721074
if (ret)
@@ -1695,7 +1697,8 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev,
16951697
i++;
16961698
memcpy(buf_cpy, buf, count-i);
16971699
tmp_str = buf_cpy;
1698-
while ((sub_str = strsep(&tmp_str, delimiter)) != NULL) {
1700+
while (tmp_str[0]) {
1701+
sub_str = strsep(&tmp_str, delimiter);
16991702
ret = kstrtol(sub_str, 0, &parameter[parameter_size]);
17001703
if (ret)
17011704
return -EINVAL;

0 commit comments

Comments
 (0)