From: Alex Deucher <alexdeucher@gmail.com>
To: "Paweł Gronowski" <me@woland.xyz>
Cc: Alex Deucher <alexander.deucher@amd.com>,
amd-gfx list <amd-gfx@lists.freedesktop.org>
Subject: Re: [PATCH] drm/amdgpu: Fix regression in adjusting power table/profile
Date: Wed, 29 Jul 2020 22:53:37 -0400 [thread overview]
Message-ID: <CADnq5_NQ9Oo85cV49+3pcQZTrBBc5HvoV_MQ_-wAmPhuzhq6uA@mail.gmail.com> (raw)
In-Reply-To: <20200729231106.GA6598@tower>
On Wed, Jul 29, 2020 at 10:20 PM Paweł Gronowski <me@woland.xyz> wrote:
>
> Regression was introduced in commit 38e0c89a19fd
> ("drm/amdgpu: Fix NULL dereference in dpm sysfs handlers") which
> made the set_pp_od_clk_voltage and set_pp_power_profile_mode return
> -EINVAL for previously valid input. This was caused by an empty
> string (starting at the \0 character) being passed to the kstrtol.
>
> Signed-off-by: Paweł Gronowski <me@woland.xyz>
Applied. Thanks!
Alex
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> index ebb8a28ff002..cbf623ff03bd 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> @@ -778,12 +778,14 @@ 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 ((sub_str = strsep(&tmp_str, delimiter)) && *sub_str) {
> ret = kstrtol(sub_str, 0, ¶meter[parameter_size]);
> if (ret)
> return -EINVAL;
> parameter_size++;
>
> + if (!tmp_str)
> + break;
> while (isspace(*tmp_str))
> tmp_str++;
> }
> @@ -1635,11 +1637,14 @@ 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 ((sub_str = strsep(&tmp_str, delimiter)) && *sub_str) {
> ret = kstrtol(sub_str, 0, ¶meter[parameter_size]);
> if (ret)
> return -EINVAL;
> parameter_size++;
> +
> + if (!tmp_str)
> + break;
> while (isspace(*tmp_str))
> tmp_str++;
> }
> --
> 2.25.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2020-07-30 2:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-29 23:11 [PATCH] drm/amdgpu: Fix regression in adjusting power table/profile Paweł Gronowski
2020-07-30 2:53 ` Alex Deucher [this message]
2020-07-30 14:49 ` Matt Coffin
2020-07-31 0:31 ` Paweł Gronowski
2020-07-31 0:34 ` Matt Coffin
2020-07-31 13:34 ` Paweł Gronowski
2020-07-31 20:20 ` Paweł Gronowski
2020-07-31 21:25 ` Matt Coffin
2020-07-31 21:39 ` Matt Coffin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADnq5_NQ9Oo85cV49+3pcQZTrBBc5HvoV_MQ_-wAmPhuzhq6uA@mail.gmail.com \
--to=alexdeucher@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=me@woland.xyz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).