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

Alex Deucher alexdeucher at gmail.com
Fri Jan 22 23:12:41 UTC 2021


On Thu, Jan 21, 2021 at 3:41 AM Evan Quan <evan.quan at amd.com> wrote:
>
> Supplement of previous fix "2d873f24dfaf drm/amdgpu/pm: Account for extra
> separator characters in sysfs interface".
>
> Change-Id: Ie9e9a78ad8530ba4b46ea27e28559d5dcda5c033
> Signed-off-by: Evan Quan <evan.quan at amd.com>

Acked-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  drivers/gpu/drm/amd/pm/amdgpu_pm.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
> index ba1539f6e0ce..ac150e63dd25 100644
> --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
> +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
> @@ -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
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list